Opened 14 years ago

Closed 14 years ago

#1627 closed enhancement (fixed)

Allow resetting cropdetect after a number of frames.

Reported by: quetschke@… Owned by: reimar
Priority: normal Component: vf
Version: HEAD Severity: minor
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

I found that cropdetect sometimes fails to detect the black areas correctly. The following (9MB) sample is part of a recording with black letterbox bars.

http://www.scytek.de/cropbug.mpg

I noticed that in the original recording (45min) the detection of the lower letterbox bar started to fail in the second half of the file and I cut this short sample out of the recording to demonstrate the effect. In the first 5 seconds there is a channel logo in the lower left corner, so cropdetect is right in not detecting the lower bar, but for the remaining 7 seconds it should work.

Version: svn 30322, downloaded here: http://oss.netfarm.it/mplayer-win32.php , but the problem is reproducible with all earlier versions that I tried.

Recipe: The following command generates about one [crop] value every second:
$ mplayer.exe cropbug.mpg -sstep 1 -vf cropdetect=24:16,scale -nosound -noaspect

[swscaler @ 011613D4]BICUBIC scaler, from yuv420p to yuyv422 using MMX2
VO: [directx] 720x480 => 720x480 Packed YUY2
[CROP] Crop area: X: 6..699 Y: 57..476 (-vf crop=688:416:10:60).
[CROP] Crop area: X: 6..699 Y: 57..476 (-vf crop=688:416:10:60).
[CROP] Crop area: X: 6..699 Y: 57..476 (-vf crop=688:416:10:60).
[CROP] Crop area: X: 6..699 Y: 57..476 (-vf crop=688:416:10:60).
[CROP] Crop area: X: 6..700 Y: 57..476 (-vf crop=688:416:10:60).
[CROP] Crop area: X: 6..700 Y: 57..476 (-vf crop=688:416:10:60).
[CROP] Crop area: X: 6..700 Y: 57..476 (-vf crop=688:416:10:60).

I tried various values for the threshold value, but it does not help.

If I cut away the first part with the channel logo, then the cropdetection
correctly recognizes
[CROP] Crop area: X: 6..700 Y: 57..420 (-vf crop=688:352:10:64).
for the second part of that clip.

Attachments (1)

bug1627.diff (2.3 KB ) - added by quetschke@… 14 years ago.
Patch to enhance cropdetect

Download all attachments as: .zip

Change History (7)

comment:1 by reimar, 14 years ago

Resolution: invalid
Status: newclosed

That is the intended behaviour of cropdetect, it will detect the largest area that was used by the video at any time during playback.

comment:2 by quetschke@…, 14 years ago

That makes the feature pretty useless and it is not mentioned in the man page.

The idea behind the -sstep 1 was to get a crop area every minute. I use a script that collects all [CROP] lines and then chooses the most common value - exactly to work around the placement of channel logos and advertisements.

Is there any way to disable the history keeping part of this feature? That would be very useful.

comment:3 by reimar, 14 years ago

The feature is meant for manual use, not automated like you want to do.
Except waiting for someone to implement the feature you want (or do it yourself) you could also start MPlayer multiple times giving a -ss value a second apart each time.

comment:4 by reimar, 14 years ago

Resolution: invalid
Severity: normalenhancement
Status: closedreopened
Summary: cropdetect fails to detect lower letterbox barAllow resetting cropdetect after a number of frames.

Keep this as feature request.
The code is in libmpcodecs/vf_cropdetect.c and is about as simple as it gets in MPlayer.

by quetschke@…, 14 years ago

Attachment: bug1627.diff added

Patch to enhance cropdetect

comment:5 by quetschke@…, 14 years ago

Indeed, it's pretty simple to implement. What do you think of the attached patch?

comment:6 by reimar, 14 years ago

Resolution: fixed
Status: reopenedclosed

Close. Your patch added trailing whitespace, which can't be committed to SVN, the static variable would have caused chaos if someone used more than one cropdetect filter and we already had a frame counter anyway.
Applied with modifications to fix these.

Note: See TracTickets for help on using tickets.