[FFmpeg-user] Possible feature additions for concatenating video files

dg1727 at hushmail.com dg1727 at hushmail.com
Wed Jan 4 21:58:01 CET 2012


I am trying to concatenate (on Ubuntu Linux), without transcoding, 
some FLV files which have H.264 video and AAC audio.  They were 
originally split from a longer video, so the frame rates must have 
been the same originally.  

First I changed the container from FLV to MP4 [1] as follows:  

for f in *.flv; do \
ffmpeg -i "$f" -vcodec copy -acodec copy "${f%.flv}.mp4"; \

Next, I tried to concatenate the MP4 files using MP4Box.  The 
resulting file had the audio out of sync with the video.  Then I 
found, using "MP4Box -info", that the audio duration of each file 
was different from the video duration, so [2] MP4Box didn't 
concatenate the videos in the way I expected.  

I browsed the discussion in [3], which told me that sometimes the 
video-frames-per-second field of a video file is in error so that 
software computes the wrong video duration from this field.  
Indeed, calculating from the audio duration of one of my files 
produced a video FPS of about 24.9787 instead of the 25.0000 
indicated by the reported video duration.  It seems like 24.9787 is 
the correct value.  I then thought of the following proposed 

A.  An option in FFmpeg to assume that the input file is correct 
(audio and video have the same duration) except that only the video-
FPS field is wrong.  This option would change only the video-FPS 
field to make the computed video duration match the audio duration. 
 Preferably, this option could be given to the "ffmpeg" command in 
the FLV-to-MP4 step listed above.  

Also, I found a couple of software tools that gave me warnings 
like, "This file uses H.264.  If there are B-frames, something may 
not work right."  So I would also like the following feature:  

B.  A feature (maybe in ffprobe?) which reports the total number of 
I-frames, P-frames, and B-frames in a given video stream (any 
format, not just H.264).  This way, if the file has no B-frames, I 
can happily use tools on it that warn me that B-frames may cause 

Do proposed features A and B already exist?  If not, should I make 
tickets in Trac to request that these features be added to FFmpeg?  

If these features exist in software other than FFmpeg, I would be 
interested to know that, but I would still like these features to 
be in FFmpeg to make it more of a "one-stop shop."  I hope these 
features would not be hard to add to FFmpeg anyway.  

I appreciate any comments.  

[1] http://ubuntuforums.org/showthread.php?t=1687798&page=2
[2] comment 5 on 
[3] http://forum.doom9.org/archive/index.php/t-157642.html

More information about the ffmpeg-user mailing list