[FFmpeg-user] Sync Issue After Clipping MPEG-2 Long GoP and PCM

Eoin ogiollae at tcd.ie
Fri Aug 30 12:36:25 CEST 2013

Hi all,
I am working on an audio-visual speech recognition project at the moment,
and I have a bunch of ~4second MKV clips containing MPEG-2 Long GoP video
and mono PCM audio. The clips were obtained by clipping longer videos in the
same format using commands with the format: 
ffmpeg -i long_vid.mkv -vcodec copy -acodec copy -ss 00:xx:xx.xxxx -t
00:xx:xx.xxxx short_clip.mkv

After reading:
http://ffmpeg.org/pipermail/ffmpeg-user/2013-August/016614.html , 
I now realize that my videos have probably been cut at the closest I-frames
to the times specified. This is actually not necessarily a bad thing - I
don't need frame-accurate clipping, as long as my audio and video are
in-sync, which they are when I play the clips back in VLC. 
The problem begins when I then extract the audio from the clips using: 
ffmpeg -i short_clip.mkv -vn -acodec copy audio.wav
This extracted audio seems to be out of sync with the clip it came from.
This is a problem, as the label files I obtain for speech in the audio won't
match up with the video frames I extract in Matlab. 

If I could figure out, for each clip, how much the extracted audio and video
will be out of sync, I could simply apply this offset to my label files. So,
I guess my question is: what exactly does ffmpeg do with my 1st command
above, when the input is MPEG-2 Long GoP video and PCM audio in an MKV

View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Sync-Issue-After-Clipping-MPEG-2-Long-GoP-and-PCM-tp4661002.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.

More information about the ffmpeg-user mailing list