[FFmpeg-user] How to split and then concatenate a video file?

Nicolas George nicolas.george at normalesup.org
Thu Feb 21 23:02:14 CET 2013

Le tridi 3 ventôse, an CCXXI, Stefano Sabatini a écrit :
> Bug confirmed.
> ffmpeg -f lavfi -i testsrc=n=2 -f segment -codec:v h264 -bf:v 0 -segment_time 2 -map 0 -reset_timestamps 1 -segment_list test.cat -t 60 test-%03d.mp4
> ffmpeg -f concat -i test.cat -c copy -y test-joined.mp4
> ffprobe -show_entries packet=pts_time test-joined.mp4  -of compact
> [...]
> packet|pts_time=9.840000
> packet|pts_time=9.880000
> packet|pts_time=9.920000
> packet|pts_time=9.960000
> packet|pts_time=10.242031
> packet|pts_time=10.282031
> packet|pts_time=10.322031
> [...]
> The bug seems located in the concat code.

ffprobe -show_format -show_entries format=duration test-000.mp4

The concat demuxer is using that info to compute the time delta for each
file, and it is obviously wrong (it should be exactly 10). The same
phenomenon happens, with different values, with Matroska instead of MP4 as
segment format, therefore I suspect something wrong in the segment demuxer.

The duration directive in the concat script could be used to override the
incorrect information, but it is not in the official repository yet. Review
of the following patches:


would speed inclusion a bit.


  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/20130221/00c38b9c/attachment.asc>

More information about the ffmpeg-user mailing list