Message ID | 20171208001440.46440-1-ffmpeg@tmm1.net |
---|---|
State | New |
Headers | show |
2017-12-08 1:14 GMT+01:00 Aman Gupta <ffmpeg@tmm1.net>: > From: Aman Gupta <aman@tmm1.net> > > Previously, using a filter that changed frame_rate/time_base would work > as expected with mpegtsenc, but duplicate frames when used with hlsenc > (which uses mpegtsenc underneath). > > For instance, using https://tmm1.s3.amazonaws.com/720p.ts: > > $ ffmpeg -i 720p.ts -c:v libx264 -an -filter:v "yadif=mode=send_field:deint=interlaced" -f mpegts -y single.ts > $ ffmpeg -i 720p.ts -c:v libx264 -an -filter:v "yadif=mode=send_field:deint=interlaced" -f hls -hls_time 30 -y segment.m3u8 > > One would expect single.ts and segment0.ts to be identical, however comparing them shows: > > single.ts: 120 fps, 59.94 tbr, 90k tbn, 239.76 tbc > segment0.ts: 120 fps, 119.88 tbr, 90k tbn, 239.76 tbc > > Without AVFMT_VARIABLE_FPS set, ffmpeg.c was duplicating frames in the hlsenc > case and generating segments with double the r_frame_rate. > > After this commit, the two muxers generate identical output. But the mp4 muxer does not support variable frame rate output... Carl Eugen
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 7dc8f4237b..d256498244 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2335,7 +2335,7 @@ AVOutputFormat ff_hls_muxer = { .audio_codec = AV_CODEC_ID_AAC, .video_codec = AV_CODEC_ID_H264, .subtitle_codec = AV_CODEC_ID_WEBVTT, - .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH, + .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_ALLOW_FLUSH, .write_header = hls_write_header, .write_packet = hls_write_packet, .write_trailer = hls_write_trailer,
From: Aman Gupta <aman@tmm1.net> Previously, using a filter that changed frame_rate/time_base would work as expected with mpegtsenc, but duplicate frames when used with hlsenc (which uses mpegtsenc underneath). For instance, using https://tmm1.s3.amazonaws.com/720p.ts: $ ffmpeg -i 720p.ts -c:v libx264 -an -filter:v "yadif=mode=send_field:deint=interlaced" -f mpegts -y single.ts $ ffmpeg -i 720p.ts -c:v libx264 -an -filter:v "yadif=mode=send_field:deint=interlaced" -f hls -hls_time 30 -y segment.m3u8 One would expect single.ts and segment0.ts to be identical, however comparing them shows: single.ts: 120 fps, 59.94 tbr, 90k tbn, 239.76 tbc segment0.ts: 120 fps, 119.88 tbr, 90k tbn, 239.76 tbc Without AVFMT_VARIABLE_FPS set, ffmpeg.c was duplicating frames in the hlsenc case and generating segments with double the r_frame_rate. After this commit, the two muxers generate identical output. --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)