[Ffmpeg-devel] [Ffmpeg-devel-old] Re: avi out is buggy

Michel Bardiaux mbardiaux
Mon May 9 14:31:54 CEST 2005


Erik Slagter wrote:
> On Mon, 2005-05-09 at 11:24 +0000, Thomas Herrmann wrote:
> 
>>>stream copy from mpeg to avi isnt synchronizable, mpeg has timestamps, avi 
>>>does not, so frame drop / audio resampling might be needed but its not 
>>>possible with stream copy
>>>
>>>-> bug closed / invalid
>>
>>Ok, but your answer does not help me to generate usable video file.
>>
>>I was asking what output format and/or ffmpeg options should I use to transcode
>>a MPEG file containing a MPEG2 video stream and an AC3 audio stream to a video
>>file (avi, mpg, mov, ... ???) containing a h264 video stream and a ac3/aac
>>audion stream?
>>
>>I tried:
>>
>>ffmpeg -i sample_w_ac3.mpg -vcodec h264 -acodec copy -sameq -hq out.avi
>>
>>which leads to asynchronous output, so does:
>>
>>ffmpeg -i sample_w_ac3.mpg -vcodec h264 -acodec aac -sameq -hq out.avi
> 
> 
> How about using mp4 output container (which does understand timestamps).
> 

Since the posted commands produce a desynched avi from a file that is 
said to play correctly in mplayer, one could deduce that the streams in 
it are not inherently synchronized, but the synchro is maintained by the 
timestamps themselves; in other words, as Michael wrote, at places there 
are too many or not enough audio samples. Obviously that cant be done if 
acodec=copy. But if the audio is decoded then re-encoded, then ffmpeg 
*should* be able to produce well-synchronized raw elementary streams at 
the intermediate stage (after decoding, before encoding) or else the A/V 
synch code is buggy. What it does exactly is not 100% clear from the 
source, ffmpeg.c does not seem to make up its mind clearly whether 
timestamps or rate-times-count hold the truth. That is, the intermediate 
stage itself is not a well-specified format, the input and output 
formats contaminate it. Contrast with the simplicity brought on by the 
decision that YUV420P is *the* native internal pixel-format.

Aside: IIRC DVDs use AC3 sound under the name "DTS", but am unsure 
whether this is *in* some kind of A+V MPEG stream, or in a separate 
file. Hence: is AC3 audio legal in an MPEG (2) container?

-- 
Michel Bardiaux
Peaktime Belgium S.A.  Bd. du Souverain, 191  B-1160 Bruxelles
Tel : +32 2 790.29.41





More information about the ffmpeg-devel mailing list