[FFmpeg-user] Concat videos properly (without dropped or freezed frames)

Nicolas George nicolas.george at normalesup.org
Wed Mar 6 19:15:08 CET 2013

Le sextidi 16 ventôse, an CCXXI, kwi wi a écrit :
> Using FFmpeg on OSX, I'm trying to concat videos taken with my phone but
> the final video is very messy.
> The audio is off, there are frozen frames on transitions, and the last
> video has a lot of dropped frames to the point where the audio starts a
> good 2 seconds before its first frame.
> The basic steps I've taken are as follows. A detailed account can be viewed
> here<
> https://docs.google.com/document/d/1ncET_V2kfKOwF8Yaro5sTjmzq_cUKmFqzAvKxYwsU1g/edit
> >
> I convert three *.3gp videos to *.mp4 with
>   $ ffmpeg -i <input file>.3gp -ar 44100 <output file>.mp4

Your command line is missing all codecs and quality settings, thus relying
on ffmpeg's defaults: this is not a good idea in general (but of course, it
can do for testing).

> I create a concat text file with these contents
>   file '/path/to/cloudy_skies.mp4'
>   file '/path/to/morning_nwc.mp4'
>   file '/path/to/snapple.mp4'
> I perform the concat with
>   $ ffmpeg -y -f concat -i clips.txt -c copy c.mp4

I notice you do two steps. This is frequently a bad idea if you can do a
single step. In this particular case, I notice that the files are ruined by
the 3GP -> MP4 conversion: concatenating without transcoding leads to a file
that seems correct (as far as it can be determined with these files: the
sound is mostly noise, there is no landmark to tell the A-V sync).

If you need to transcode, I suggest you do it at the same time as the
concatenation, using the concat filter instead of the concat format. If you
really want two steps, I suggest you do the concatenation first.

> I'm getting the following messages in the concat output:
>   [concat @ 0x7ffc93813000] Estimating duration from bitrate, this may be
> inaccurate

This is normal. You can get rid of them by inserting the "duration"
directive for each file in the concat script.

>   [mp4 @ 0x7ffc9385f800] st:0 PTS: 147194 DTS: 146810 < 149650 invalid,
> clipping
> [concat @ 0x7ffc93813000] doesn’t seem critical. Am I wrong?
> [mp4 @ 0x7ffc9385f800] seems like it drops a frame every time it’s
> encountered. Am I wrong on this assumption. How do I resolve this so the
> converted videos concat properly?

Yes, these messages seem to indicate a real problem, but I do not know what


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20130306/f7d0ecad/attachment.asc>

More information about the ffmpeg-user mailing list