[FFmpeg-devel] [PATCH] mov.c: read fragment start dts from fragmented mp4

Michael Niedermayer michaelni at gmx.at
Sat Oct 11 13:21:03 CEST 2014


On Sat, Oct 11, 2014 at 07:25:52AM +0300, Mika Raento wrote:
> If present, an MFRA box and its TFRAs are read for fragment start times.
> 
> Without this change, timestamps for discontinuous fragmented mp4 are
> wrong, and cause audio/video desync and are not usable for generating
> HLS.
> ---
>  libavformat/isom.h |  15 ++++++
>  libavformat/mov.c  | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 161 insertions(+)

this appears to breaks timestamps for some files, i didnt investigate
why

./ffmpeg -i matrixbench_mpeg2.mpg -t 1  -frag_duration 200k input.mov
./ffprobe input.mov -show_packets -print_format compact | grep audio

 packet|codec_type=audio|stream_index=1|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=N/A|duration_time=N/A|convergence_duration=N/A|convergence_duration_time=N/A|size=172|pos=17590|flags=K
 packet|codec_type=audio|stream_index=1|pts=3840|pts_time=0.080000|dts=3840|dts_time=0.080000|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=315|pos=19048|flags=K
 packet|codec_type=audio|stream_index=1|pts=4864|pts_time=0.101333|dts=4864|dts_time=0.101333|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=297|pos=19363|flags=K
 packet|codec_type=audio|stream_index=1|pts=5888|pts_time=0.122667|dts=5888|dts_time=0.122667|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=9|pos=22964|flags=K
 packet|codec_type=audio|stream_index=1|pts=6912|pts_time=0.144000|dts=6912|dts_time=0.144000|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=216|pos=22973|flags=K
 packet|codec_type=audio|stream_index=1|pts=7936|pts_time=0.165333|dts=7936|dts_time=0.165333|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=327|pos=23521|flags=K
 packet|codec_type=audio|stream_index=1|pts=8960|pts_time=0.186667|dts=8960|dts_time=0.186667|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=327|pos=23848|flags=K
-packet|codec_type=audio|stream_index=1|pts=9984|pts_time=0.208000|dts=9984|dts_time=0.208000|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=330|pos=35835|flags=K
-packet|codec_type=audio|stream_index=1|pts=11008|pts_time=0.229333|dts=11008|dts_time=0.229333|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=317|pos=36165|flags=K
-packet|codec_type=audio|stream_index=1|pts=12032|pts_time=0.250667|dts=12032|dts_time=0.250667|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=326|pos=36482|flags=K
+packet|codec_type=audio|stream_index=1|pts=48896|pts_time=1.018667|dts=48896|dts_time=1.018667|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=330|pos=35835|flags=K
+packet|codec_type=audio|stream_index=1|pts=49920|pts_time=1.040000|dts=49920|dts_time=1.040000|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=317|pos=36165|flags=K
...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141011/9d9edd84/attachment.asc>


More information about the ffmpeg-devel mailing list