Hello. I encountered a very subtle problem when generating DVD files with ffmpeg. In a nutshell: the files I create work with many many DVD players (stand-alone and software players) just fine, but it stumbles and stutters on one hardware player. Since this is not a cheapo player (it is a Pioneer DV-656A, indeed), and the owner never experienced such problems with any DVD, I conclude there must be something wrong with the DVD I made. As I will explain later, it is not a problem of authoring and it is very unlikely to be a problem with muxing (which is also done by ffmpeg). What I want to do is a DVD with a collection of short video clips that I have captured from DVB. So I had a couple of MPEG TS files, which I converted with dvbreplex to PS files (for the sake of a/v sync), then I used avidemux to trim it. So far, so good. Since the source material's resolution is not DVD compliant (something like 528x576), I cannot just replex them to VOB files, but I need to re-encode the video (I keep the original audio, because mp2 is fine). The command line I used: ffmpeg -i <infile> -target dvd -acodec copy -s 720x576 -aspect 4:3 -ildct -ilme -bf 2 -hq -b <bitrate> -pass 1 -passlogfile <filename> -vhook <...> out.vob (and then the same with "-pass 2") I have a python script which creates neat menues and afterwards dvdauthor puts it all together. The symptoms: * The DVD plays fine on my stand alone DVD player (Grundig GDP2400) and some others I tried (Yamaha, Philips). MPlayer, xine, ogle, some Windows softare (don't remember the name) all play the DVD just fine. * With one DVD player (Pioneer DV-656A), the video playback of the ffmpeg generated stuff is terrible: it stumbles and stutters all the way. Usually, after a few seconds you see the video frozen while audio is playing on. After a short time (like a second or so, sometimes much longer), the video is back (and in perfect sync with audio). Only a few seconds later, the same things happens again, sometimes several times, before the player just skips the rest of the current track and goes on with the next one. If you play the same track again, you will notice that the player stumbles at exactly the same places again. You might say that this must be a problem of the player and not ffmpeg's fault. Well, yes. But: that player has no problem with bought DVDs. Also selfmade DVDs with not-ffmpeg-coded material works! DVB grabs (from stations with a DVD compliant resolution like 720x576) work fine. I just use dvbreplex to make a VOB from the TS, and it works fine. I write one DVD with ffmpeg-encoded videos and a DVD-ripped track, a DVB-grabbed track, and mpeg2enc-generated tracks. Everything plays fine, also on that Pioneer player, only the ffmpeg-generated videos stumble. I don't even think that the ffmpeg generated video is not officially DVD compliant. But apart from the official DVD specifications, there might exist some quasi standards. Editors of commercial DVDs and DVB stations might follow this quasi standard and some broken players rely on it. E.g. I found reports on the internet, that some players need to have 2 B-Frames between I/P-Frames, which is certainly not a requirement of the official DVD standard. But all commercial DVD I tried, plus the 720x576-DVB stream I grabbed, do have these two B-frames. So it might not be ffmpeg's fault, but anyway, I am interested in producing DVDs which play everywhere, of course. I mentioned the mpeg2enc-generated material works, but I really would like to stick to ffmpeg, because it's so much faster, it supports two pass encoding, and it is much easier to use than mpeg2enc+mplex. Things I already tried (I'm only talking about the Pioneer player now): I varied the command line options. I tried things like "-sgop", "-bf 0", "-bf 1", "-bf 2", one pass encoding, leaving out "-ildct" and "-ilme", specifying max bitrates of 9000, 7500 or none at all, leaving out "-hq". All this had no effect. When changing some of the command line options, the places at which the video stumble can change. For example, without "-hq", the video was a bit more stable. I have written a small analyzer for the m2v video, just to analyse the sequence of I,P,B frames and see what's in the sequence header and GOP header. For me, everything looks fine and I cannot find a difference to VOBs from other sources. I think the "-sgop" option doesn't work, at least not the way I understand it. Even when supplying that option, the GOP sizes vary. Maybe the problem is even in that area... I have the feeling that the stumbling can be triggered by a very short GOP. E.g. there is one GOP of only 3 frames (I-B-B), and I think this is the place at which the video stumbles first. When using mpeg2enc, I encountered a warning that a scene change was detected, but a new GOP cannot be started because the current one would end up being too short. That might be a hint. But: I have other videos (my menues on the DVD) which have short GOPs only after a minute or so, and they stumble right within the first few seconds. So after all... it doesn't make any sense for me anymore.... So... I apologize for this _long_ mail. Maybe someone has an idea, what option to try, or there is even something that has to be changed in the ffmpeg code. Thanks for your help. And thanks too all ffmpeg developers for ffmpeg! -- Sven Over Stephanienstr. 9 76133 Karlsruhe Telefon: 0721-9204199 http://www.svenover.de/
Sven Over wrote:
I have the feeling that the stumbling can be triggered by a very short GOP. E.g. there is one GOP of only 3 frames (I-B-B), and I think this is the place at which the video stumbles first.
this is impossible: B-frames depend on the surrounding I and P frames to be decoded. libavcodec doesn't forget to store all of them :) -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: la vetrina delle aziende del Canavese industriali, artigianali e di servizi Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3606&d=25-7
Am Montag, 25. Juli 2005 11:30 schrieb Nico Sabbi:
Sven Over wrote:
I have the feeling that the stumbling can be triggered by a very short GOP. E.g. there is one GOP of only 3 frames (I-B-B), and I think this is the place at which the video stumbles first.
this is impossible: B-frames depend on the surrounding I and P frames to be decoded. libavcodec doesn't forget to store all of them :)
No, why? The two B-frames encode the video between the last I/P-frame of the previous GOP and the I-frame in this GOP. The "temporal sequence" fields in the picture headers then are 2-0-1. I don't mean that ffmpeg forgot to store any pictures. This is just a very short GOP, comprising only three frames. As far as I know this is okay with respect to the standards. But possibly there is a de facto standard for a minimum GOP size. -- Sven Over Stephanienstr. 9 76133 Karlsruhe Telefon: 0721-9204199 http://www.svenover.de/
Hi On Monday 25 July 2005 10:53, Sven Over wrote:
Hello.
I encountered a very subtle problem when generating DVD files with ffmpeg. In a nutshell: the files I create work with many many DVD players (stand-alone and software players) just fine, but it stumbles and stutters on one hardware player. Since this is not a cheapo player (it is a Pioneer DV-656A, indeed), and the owner never experienced such problems with any DVD, I conclude there must be something wrong with the DVD I made. As I will explain later, it is not a problem of authoring and it is very unlikely to be a problem with muxing (which is also done by ffmpeg).
did you try ffmpeg encoding + mplex and mpeg2enc with ffmpeg muxing? it would be interresting as we would then know if its encoding or muxing where the problem is where do the problems occur some high motion or boring not changing scene? [...]
I think the "-sgop" option doesn't work, at least not the way I understand it. Even when supplying that option, the GOP sizes vary. Maybe the problem is even in that area... I have the feeling that the stumbling can be triggered by a very short GOP. E.g. there is one GOP of only 3 frames (I-B-B), and I think this is the place at which the video stumbles first. When using mpeg2enc, I encountered a warning that a scene change was detected, but a new GOP cannot be started because the current one would end up being too short. That might be a hint. But: I have other videos (my menues on the DVD) which have short GOPs only after a minute or so, and they stumble right within the first few seconds. So after all... it doesn't make any sense for me anymore....
try -sc_threshold 1000000000 and try -cgop maybe try to change -mux_delay also try reencoding audio with -async 100 instead of -acodec copy ahh and tell us if any of that helped [...] -- Michael
Am Montag, 25. Juli 2005 12:49 schrieb Michael Niedermayer:
very unlikely to be a problem with muxing (which is also done by ffmpeg). did you try ffmpeg encoding + mplex and mpeg2enc with ffmpeg muxing? it would be interresting as we would then know if its encoding or muxing
Ah, sorry... I forgot to mention this... I said it was unlikely to be a muxing problem. So I did extract the audio and video streams from the ffmpeg output and multiplexed them again with mplex. The resulting file caused the same problems as the original ffmpeg output. I didn't try it the other way round. I'm not sure, I guess I the command line has to look like ffmpeg -i video.m2v -i audio.mp2 -vcodec copy -acodec copy -target dvd out.vob to do only the muxing with ffmpeg...
where the problem is where do the problems occur some high motion or boring not changing scene?
Hard to say... there is one video clip I mostly used for testing, and there it is a scene change. But I also have smooth videos where it happens.
try -sc_threshold 1000000000
That would set the scene change threshold to virtually infinite, I guess. Would that mean that scene changes are no more detected and each GOP has maximum size? I thought that would be the meaning of "-sgop" (strict gop), to have all GOPs the same size. Am I wrong, or is the "-sgop" not working currently?
and try -cgop
Ah, with "-cgop" ffmpeg quits with an error message. I don't remember which one. I am at work at the moment. I will try out your suggestions tonight...
maybe try to change -mux_delay also try reencoding audio with -async 100 instead of -acodec copy
Okay, thanks for the suggestions.
ahh and tell us if any of that helped
Of course I will. In case I find a solution which has no negative side effects, but makes the video work on that Pioneer player as well, it might be a good idea to include this setting to the DVD target preset in ffmpeg. Thank for your help... -- Sven Over Stephanienstr. 9 76133 Karlsruhe Telefon: 0721-9204199 http://www.svenover.de/
Am Montag, 25. Juli 2005 12:49 schrieb Michael Niedermayer:
try -sc_threshold 1000000000 and try -cgop maybe try to change -mux_delay also try reencoding audio with -async 100 instead of -acodec copy
ahh and tell us if any of that helped
I tried all of it... to no success. I also tried the mpeg2enc video, muxed by ffmpeg. That one was completely unplayable on the Pioneer player. I heard maybe the first two seconds of the sound while the menu image was still showing, before the player switched to the next track. My Grundig DVD player could play this one, but a/v was out of sync by about 1 second (audio was delayed). Yesterday I prepared some more test files, produced with ffmpeg and other command line options, but I don't have much hope that'll help. 'Mean' from the ffmpeg-devel list wrote me off list. He said that some Pioneer players are very picky about the MPEG/DVD standards and therefore are well suited to act as debugging machines. So after all, I have the feeling the ffmpeg output video is only 99.9% MPEG (or DVD) compliant. Anyway. I found the ISO documents on MPEG2 on the internet. If I also find some time, I will have look at them, maybe I have an idea... There is also a page describing the additional restrictions of a DVD to the MPEG 2 standard. http://www.mpeg.org/MPEG/DVD/Book_B/Video.html Most of it a trivial requirements like image size of 720x576 at 25fps. Apart from that, the DVD MPEG2 has to be main profile at main level. According to the "picture coding extension" fields written by ffmpeg, the generate video *is* MP at ML. The MPEG2 standard describes the requirements for MP at ML, maybe ffmpeg does respect one of the limitations fully... So, no success so far... -- Sven Over Stephanienstr. 9 76133 Karlsruhe Telefon: 0721-9204199 http://www.svenover.de/
participants (3)
-
michaelni@gmx.at -
nsabbi@email.it -
svenover@svenover.de