[FFmpeg-trac] #2421(undetermined:new): DTS/PTS problems when trying to obtain synced video and audio files

FFmpeg trac at avcodec.org
Mon Apr 1 18:46:49 CEST 2013


#2421: DTS/PTS problems when trying to obtain synced video and audio files
-------------------------------------+-------------------------------------
             Reporter:  chlg         |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  important    |                Component:
              Version:  git-master   |  undetermined
             Keywords:  regression   |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by chlg):

 Globally : I want to manipulate (crop, concatenate, ...) with a "frame"
 precision (ie 40ms precision) movies (eg, remove the commercials).
 I do this in a very brutal way :
 - I first create huge raw data files : yuv420 for images (each image is
 exactly W*H*1.5 bytes in the yuv file) and PCM for audio (each "image"
 matches a constant size of audio sample ; eg 44100*2*2/25 for PAL DVD) ;
 - I then manipulate them with very simple tools (dd, cat, and some
 homemade)
 - With the transformed YUV/PCM, I reencode a x264/ogg mkv file

 The command is about the first step : obtaining raw data from a movie,
 with "ultimate constant bitrate". Ie, where //dd if=input of=output
 count=duration*B skip=start*B // creates a file "output" which is the file
 "input" cropped with a given duration and start time (B being the constant
 amount of bytes per second : W*H*1.5*fps for video,
 SamplePerSec*NumChannel*BytePerSample for audio)

 (This is probably a very dumb way to proceed. But I'm to lazy to
 understand how to do that for each possible input file format ; and
 existing movie editor software are not enough extendable. For example, I
 have code for autodetection of commercial, for automatic cropping. Anyway,
 wether this is stupid or not is not related to the bug).


 I'm sure you known most of the options, but just in case I detail all :
 - -v 9 -loglevel 99 : to have all possible output on the console
 - -i async_etc.ts : input file
 - -y : overwrite output files without confirmation (of course it is
 useless the first time)
 - -vsync 1 : ensure constant frame rate in output yuv file (duplicate or
 drop frames if needed)
 - yy.yuv : output yuv file
 - -async 480 : ensure almost constante byte rate in audio output (maximum
 of 480 samples of drift ; needed because, of course, juste dropping or
 duplicating audio sample is a bad idea)
 - -f s16le : produce raw pcm file (wave without header)
 - yy.raw : output pcm file

 That way, yy.yuv and yy.raw can be manipulated with tools such as dd. And
 moreover, they are synchronised (as long as the input file has no
 synchronisation problem), since both files are kept with a constant
 byterate according to the timestamps : each time the timestamp of the
 inputfile grows of 1 second, a constant amount of data is produced in
 output files, no matter how (by duplicating, dropping or stretching data
 if needed)

 Please, excuse the long post. But since I must admit that I'm not sure
 that I use these options for what they are made for (even if they have
 done exactly what I expected on a daily basis for years), I've preferred
 to describe my motivation.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2421#comment:6>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list