Opened 13 years ago
Closed 11 years ago
#681 closed defect (fixed)
-vf mp=pullup leads to massive A/V-desync
Reported by: | dave rice | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | mpfilter pullup |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
When I call -vf mp=pullup or (pullup,softskip) I get an "Error opening filters!" warning.
ffmpeg -y -i example.mov -vf mp=pullup -r 24000/1001 -c:v v210 -c:a copy example_ivtc.mov ffmpeg version N-33392-gf3bacce, Copyright (c) 2000-2011 the FFmpeg developers built on Oct 8 2011 18:33:19 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3) configuration: --enable-gpl libavutil 51. 20. 0 / 51. 20. 0 libavcodec 53. 19. 1 / 53. 19. 1 libavformat 53. 14. 0 / 53. 14. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 43. 6 / 2. 43. 6 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x101005800] Unimplemented container channel layout. [mov,mp4,m4a,3gp,3g2,mj2 @ 0x101005800] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ and contact the ffmpeg-devel mailing list. Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'example.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2011-11-05 17:32:17 Duration: 00:19:52.02, start: -39.572900, bitrate: 1122 kb/s Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le, 720x486, 223725 kb/s, SAR 9:10 DAR 4:3, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc Metadata: creation_time : 2011-11-05 17:32:17 Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s Metadata: creation_time : 2011-11-05 17:32:17 Stream #0:2(eng): Data: none (tmcd / 0x64636D74) Metadata: creation_time : 2011-11-05 17:32:17 [buffer @ 0x100e01900] w:720 h:486 pixfmt:yuv422p10le tb:1/1000000 sar:9/10 sws_param: [mp @ 0x100e040c0] This is a unholy filter, it will be purified by the ffmpeg exorcist team which will change its syntax from dark -vf mp to light -vf. Thou shalst not make spells or scripts that depend on it [buffersink @ 0x100e03d80] auto-inserting filter 'auto-inserted scale 0' between the filter 'Parsed_mp_0' and the filter 'out' [mp @ 0x100e040c0] auto-inserting filter 'auto-inserted scale 1' between the filter 'src' and the filter 'Parsed_mp_0' [scale @ 0x100e04a80] w:720 h:486 fmt:yuv422p10le -> w:720 h:486 fmt:yuv420p flags:0x4 Error opening filters!
Change History (8)
comment:1 by , 13 years ago
Component: | undetermined → avfilter |
---|---|
Keywords: | mp pullup added |
Reproduced by developer: | set |
Status: | new → open |
Version: | unspecified → git-master |
follow-up: 3 comment:2 by , 12 years ago
The filter works fine with the following command line for the given sample:
$ ffmpeg -i vts_01_1.1st_50M.vob -qscale 2 -vf 'mp=pullup=4:4:20:20:-1:0,mp=softskip,setpts=N/(24000/1001*TB)' -r 24001/1001 out.avi
It fails for another sample here.
comment:3 by , 12 years ago
Keywords: | mpfilter added; mp removed |
---|---|
Summary: | -vf mp=pullup is not working → -vf mp=pullup leads to massive A/V-desync |
Replying to cehoyos:
It fails for another sample here.
That was because height was not a multiple of four (error message committed to MPlayer, will be merged).
The filter works in the sense that it can remove interlaced frames from telecined content, unfortunately it breaks AV-sync for longer samples.
Note that the filter only supports yuv420p and I believe this is unlikely to change soon (it simply does not work for v210 samples if you don't change the colour space).
comment:4 by , 12 years ago
The following works for clean (uncut) telecined material like a sample I produced with -vf mp=telecine:
$ ffmpeg -i telecined -vf mp=detc=am=0:dr=2:fr=0,setpts='N/(24000/1001*TB)' -qscale 2 -r 24000/1001 out.avi
If this is of any use, it should be possible to extend it for yuv422p10.
follow-up: 6 comment:5 by , 12 years ago
Thank you, cehoyos, for your work on this. I found this ticket #681 while searching for a filterchain to do effective ivtc in ffmpeg.
There is an excellent discussion in the Mplayer documentation of the various ivtc options in section 7.2.3.4. Mixed progressive and telecine. (The filmdint filter mentioned there, which sounds very promising, is unfortunately not supported in ffmpeg.)
When I first found this ticket, this solution was your last update. When I tried it, I too experienced massive A/V desync. In fact, there was desync with every other Mplayer filter I tried except the one you quote just above, and with the same options—
mp=detc=am=1:dr=2
for example, also causes desync.
Section 7.2.3.4 of the Mplayer docs suggests placing the softpulldown filter before detc or ivtc in order to insure those filters have a uniformly telecine'd stream to process. Additionally, I noticed that the output of detc is interlaced. I was able to get good results with this filterchain:
-vf mp=softpulldown,mp=detc=am=0:dr=2:fr=0,yadif,setpts='N/(24000/1001*TB)' -r 24000/1001
Ultimately, the reason for the A/V desync with the other Mplayer filters is the equation for setpts (='N/(24000/1001*TB)') which, according to Section 31.2.1 of the ffmpeg docs, sets a fixed frame rate. What is needed is an equation for setpts that produces an output stream with the same running time as the input stream, regardless of how many frames the preceding filters drop. Perhaps someone with some math skills and an understanding of the setpts internal variables could write one for us???? :)
(It seems likely that MEncoder includes code to make this calculation internally. In every discussion I have read concerning how to ivtc with MEncoder, there is no mention of any A/V desync problems, and no inclusion of any sort of a setpts filter in any of the sample command lines—these things are conspicuous by their absence. Instead, MEncoder has separate command line options for the input stream framerate, and the desired output framerate.)
comment:6 by , 12 years ago
Replying to darkmoon:
When I first found this ticket, this solution was your last update. When I tried it, I too experienced massive A/V desync.
In fact, there was desync with every other Mplayer filter I tried
Could you elaborate?
I don't think this is a known problem. (Or do you mean: With every other MPlayer inverse telecine filter except detc which unfortunately does not work for the real-world samples you have?)
except the one you quote just above, and with the same options—
mp=detc=am=1:dr=2for example, also causes desync.
Section 7.2.3.4 of the Mplayer docs suggests placing the softpulldown filter before detc or ivtc in order to insure those filters have a uniformly telecine'd stream to process.
Additionally, I noticed that the output of detc is interlaced.
I don't think this is correct as-such:
Of course I believe you that you tried the filter with a sample and the output looked interlaced, but the point is that the filter can only work on clean (unedited) telecined material on which it will perform a perfect inverse telecine process if invoked with the correct start-pattern.
I was able to get good results with this filterchain:
-vf mp=softpulldown,mp=detc=am=0:dr=2:fr=0,yadif,setpts='N/(24000/1001*TB)' -r 24000/1001
I live in PAL-country and I am therefore certainly no expert for telecined material, but I believe you first have to decide if your input video is interlaced or telecined and then you should either use a de-interlacer (yadif) or try an inverse telecine process (which is currently not working perfectly within FFmpeg), combining them seems like a very bad idea to me.
(Or in other words: inverse telecine is a process that recovers the original material without any quality loss whatsoever, while a de-interlacer gets broken input and tries to hide the brokenness by changing the video severely. Doing this on telecined input ruins every possibility to ever get back the original video.)
Ultimately, the reason for the A/V desync with the other Mplayer filters is the equation for setpts (='N/(24000/1001*TB)') which, according to Section 31.2.1 of the ffmpeg docs, sets a fixed frame rate.
I absolutely may miss something, but imo the output of inverse telecine has a fixed frame rate of 24000/1001.
What is needed is an equation for setpts that produces an output stream with the same running time as the input stream, regardless of how many frames the preceding filters drop. Perhaps someone with some math skills and an understanding of the setpts internal variables could write one for us???? :)
(It seems likely that MEncoder includes code to make this calculation internally. In every discussion I have read concerning how to ivtc with MEncoder, there is no mention of any A/V desync problems, and no inclusion of any sort of a setpts filter in any of the sample command lines—these things are conspicuous by their absence. Instead, MEncoder has separate command line options for the input stream framerate, and the desired output framerate.)
Note that in my experience, current MEncoder fails very badly for telecined material so whoever is interested in solving this problem and has some programming skills, should really work on porting pullup (or filmdint) to a native FFmpeg filter (it is imo not unlikely that timestamps are the only thing missing.)
comment:7 by , 12 years ago
I think it might work if the NoSkip filter was implemented. That should solve the problem of mencoder skipping frames without telling ffmpeg about it.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
There is native pullup filter now.
Sample:
http://samples.mplayerhq.hu/MPEG-VOB/inverse_telecine_problem/vts_01_1.1st_50M.vob
MEncoder command line:
(Intentionally missing softskip which is required for a cleaner result)
FFmpeg / mp=pullup skips nearly all frames: