Commit 46070cc2 authored by Michael Niedermayer's avatar Michael Niedermayer

ffmpeg: set muxer packet duration based on framerate only for CFR

a set ost->frame_rate does not imply CFR in ffmpeg

The changed fate tests had all wrong packet durations
(like 1/1000 or 1/90000)

There might be more cases in which is_cfr could be set
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 9ffc61b1
...@@ -672,7 +672,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) ...@@ -672,7 +672,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
ost->error[i] = -1; ost->error[i] = -1;
} }
if (ost->frame_rate.num) { if (ost->frame_rate.num && ost->is_cfr) {
pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate), pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
ost->st->time_base); ost->st->time_base);
} }
...@@ -1005,6 +1005,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1005,6 +1005,7 @@ static void do_video_out(AVFormatContext *s,
format_video_sync = VSYNC_VSCFR; format_video_sync = VSYNC_VSCFR;
} }
} }
ost->is_cfr = (format_video_sync == VSYNC_CFR || format_video_sync == VSYNC_VSCFR);
if (delta0 < 0 && if (delta0 < 0 &&
delta > 0 && delta > 0 &&
......
...@@ -421,6 +421,7 @@ typedef struct OutputStream { ...@@ -421,6 +421,7 @@ typedef struct OutputStream {
/* video only */ /* video only */
AVRational frame_rate; AVRational frame_rate;
int is_cfr;
int force_fps; int force_fps;
int top_field_first; int top_field_first;
int rotate_overridden; int rotate_overridden;
......
This diff is collapsed.
#tb 0: 1/90000 #tb 0: 1/90000
0, 0, 0, 1, 230400, 0x35e51c62 0, 0, 0, 0, 230400, 0x35e51c62
#tb 0: 1/90000 #tb 0: 1/90000
0, 0, 0, 1, 230400, 0x0929e342 0, 0, 0, 0, 230400, 0x0929e342
#tb 0: 1/1000 #tb 0: 1/1000
0, 0, 0, 1, 115200, 0xa974d407 0, 0, 0, 0, 115200, 0xa974d407
0, 548, 548, 1, 115200, 0x72618b84 0, 548, 548, 0, 115200, 0x72618b84
0, 1088, 1088, 1, 115200, 0x87768573 0, 1088, 1088, 0, 115200, 0x87768573
0, 1759, 1759, 1, 115200, 0x5d218e3e 0, 1759, 1759, 0, 115200, 0x5d218e3e
0, 2437, 2437, 1, 115200, 0x0c0db41c 0, 2437, 2437, 0, 115200, 0x0c0db41c
0, 3076, 3076, 1, 115200, 0xb777fd48 0, 3076, 3076, 0, 115200, 0xb777fd48
0, 3908, 3908, 1, 115200, 0x40765de7 0, 3908, 3908, 0, 115200, 0x40765de7
0, 4545, 4545, 1, 115200, 0x370a3c90 0, 4545, 4545, 0, 115200, 0x370a3c90
0, 5092, 5092, 1, 115200, 0xc605785a 0, 5092, 5092, 0, 115200, 0xc605785a
0, 6016, 6016, 1, 115200, 0x49468b23 0, 6016, 6016, 0, 115200, 0x49468b23
0, 6560, 6560, 1, 115200, 0x986b6fd4 0, 6560, 6560, 0, 115200, 0x986b6fd4
0, 7648, 7648, 1, 115200, 0x30f22ef8 0, 7648, 7648, 0, 115200, 0x30f22ef8
0, 8164, 8164, 1, 115200, 0xa90bd608 0, 8164, 8164, 0, 115200, 0xa90bd608
0, 8836, 8836, 1, 115200, 0x9cf36518 0, 8836, 8836, 0, 115200, 0x9cf36518
0, 9632, 9632, 1, 115200, 0x4ef1a679 0, 9632, 9632, 0, 115200, 0x4ef1a679
0, 9922, 9922, 1, 115200, 0x0df65873 0, 9922, 9922, 0, 115200, 0x0df65873
0, 10316, 10316, 1, 115200, 0xfecd4233 0, 10316, 10316, 0, 115200, 0xfecd4233
0, 11104, 11104, 1, 115200, 0xee2f26cb 0, 11104, 11104, 0, 115200, 0xee2f26cb
0, 11776, 11776, 1, 115200, 0x795f612d 0, 11776, 11776, 0, 115200, 0x795f612d
0, 12321, 12321, 1, 115200, 0xbbb90125 0, 12321, 12321, 0, 115200, 0xbbb90125
0, 12992, 12992, 1, 115200, 0x9230fb6e 0, 12992, 12992, 0, 115200, 0x9230fb6e
0, 13805, 13805, 1, 115200, 0x11869996 0, 13805, 13805, 0, 115200, 0x11869996
0, 14468, 14468, 1, 115200, 0x6b5c892b 0, 14468, 14468, 0, 115200, 0x6b5c892b
0, 15136, 15136, 1, 115200, 0x88bdb9cd 0, 15136, 15136, 0, 115200, 0x88bdb9cd
0, 15937, 15937, 1, 115200, 0x364bc5a0 0, 15937, 15937, 0, 115200, 0x364bc5a0
0, 16608, 16608, 1, 115200, 0x6b66d817 0, 16608, 16608, 0, 115200, 0x6b66d817
0, 17281, 17281, 1, 115200, 0xd3a41252 0, 17281, 17281, 0, 115200, 0xd3a41252
0, 18089, 18089, 1, 115200, 0x0cf5612f 0, 18089, 18089, 0, 115200, 0x0cf5612f
0, 18754, 18754, 1, 115200, 0x9752d055 0, 18754, 18754, 0, 115200, 0x9752d055
0, 19808, 19808, 1, 115200, 0x486e9f6f 0, 19808, 19808, 0, 115200, 0x486e9f6f
0, 20484, 20484, 1, 115200, 0x3eab62f8 0, 20484, 20484, 0, 115200, 0x3eab62f8
0, 21031, 21031, 1, 115200, 0xa7f52762 0, 21031, 21031, 0, 115200, 0xa7f52762
0, 21957, 21957, 1, 115200, 0xfd4c4bbc 0, 21957, 21957, 0, 115200, 0xfd4c4bbc
0, 22498, 22498, 1, 115200, 0x194023f6 0, 22498, 22498, 0, 115200, 0x194023f6
0, 22880, 22880, 1, 115200, 0xd4668dad 0, 22880, 22880, 0, 115200, 0xd4668dad
0, 23680, 23680, 1, 115200, 0x6b20d64b 0, 23680, 23680, 0, 115200, 0x6b20d64b
0, 24353, 24353, 1, 115200, 0xf2572aae 0, 24353, 24353, 0, 115200, 0xf2572aae
0, 24901, 24901, 1, 115200, 0xc3554f25 0, 24901, 24901, 0, 115200, 0xc3554f25
0, 25695, 25695, 1, 115200, 0xeeb5073a 0, 25695, 25695, 0, 115200, 0xeeb5073a
0, 26495, 26495, 1, 115200, 0xbd46291f 0, 26495, 26495, 0, 115200, 0xbd46291f
0, 27040, 27040, 1, 115200, 0x0526838d 0, 27040, 27040, 0, 115200, 0x0526838d
0, 28107, 28107, 1, 115200, 0x85b2e864 0, 28107, 28107, 0, 115200, 0x85b2e864
0, 28778, 28778, 1, 115200, 0xcfd894bc 0, 28778, 28778, 0, 115200, 0xcfd894bc
0, 29316, 29316, 1, 115200, 0x644f10fb 0, 29316, 29316, 0, 115200, 0x644f10fb
0, 30240, 30240, 1, 115200, 0x556e4d88 0, 30240, 30240, 0, 115200, 0x556e4d88
0, 30786, 30786, 1, 115200, 0x93243614 0, 30786, 30786, 0, 115200, 0x93243614
0, 31983, 31983, 1, 115200, 0x754275c5 0, 31983, 31983, 0, 115200, 0x754275c5
0, 32929, 32929, 1, 115200, 0x7f648bf3 0, 32929, 32929, 0, 115200, 0x7f648bf3
0, 33600, 33600, 1, 115200, 0xece18c9b 0, 33600, 33600, 0, 115200, 0xece18c9b
0, 34271, 34271, 1, 115200, 0x385d52c1 0, 34271, 34271, 0, 115200, 0x385d52c1
0, 35201, 35201, 1, 115200, 0xafc58e4a 0, 35201, 35201, 0, 115200, 0xafc58e4a
0, 35743, 35743, 1, 115200, 0x50daf750 0, 35743, 35743, 0, 115200, 0x50daf750
0, 36384, 36384, 1, 115200, 0xf6bc67d1 0, 36384, 36384, 0, 115200, 0xf6bc67d1
0, 37344, 37344, 1, 115200, 0xb64b6e07 0, 37344, 37344, 0, 115200, 0xb64b6e07
0, 38028, 38028, 1, 115200, 0x8751ed15 0, 38028, 38028, 0, 115200, 0x8751ed15
0, 38657, 38657, 1, 115200, 0x329ce803 0, 38657, 38657, 0, 115200, 0x329ce803
0, 39334, 39334, 1, 115200, 0x40b2cb05 0, 39334, 39334, 0, 115200, 0x40b2cb05
0, 40129, 40129, 1, 115200, 0x60f3517d 0, 40129, 40129, 0, 115200, 0x60f3517d
0, 40802, 40802, 1, 115200, 0xe0d46fdf 0, 40802, 40802, 0, 115200, 0xe0d46fdf
0, 41472, 41472, 1, 115200, 0x204529fa 0, 41472, 41472, 0, 115200, 0x204529fa
0, 42276, 42276, 1, 115200, 0xd5afaf22 0, 42276, 42276, 0, 115200, 0xd5afaf22
0, 42944, 42944, 1, 115200, 0xd3cb3d4c 0, 42944, 42944, 0, 115200, 0xd3cb3d4c
0, 43616, 43616, 1, 115200, 0x87973a79 0, 43616, 43616, 0, 115200, 0x87973a79
0, 44421, 44421, 1, 115200, 0xe3b2f917 0, 44421, 44421, 0, 115200, 0xe3b2f917
0, 45092, 45092, 1, 115200, 0xf1923238 0, 45092, 45092, 0, 115200, 0xf1923238
0, 45632, 45632, 1, 115200, 0x51494d71 0, 45632, 45632, 0, 115200, 0x51494d71
0, 46561, 46561, 1, 115200, 0x58bc59bb 0, 46561, 46561, 0, 115200, 0x58bc59bb
0, 47105, 47105, 1, 115200, 0xd0273fdb 0, 47105, 47105, 0, 115200, 0xd0273fdb
0, 47776, 47776, 1, 115200, 0x6cc79700 0, 47776, 47776, 0, 115200, 0x6cc79700
0, 48294, 48294, 1, 115200, 0xc8172d31 0, 48294, 48294, 0, 115200, 0xc8172d31
0, 48960, 48960, 1, 115200, 0x8eb037ef 0, 48960, 48960, 0, 115200, 0x8eb037ef
0, 49504, 49504, 1, 115200, 0xc0bc2d76 0, 49504, 49504, 0, 115200, 0xc0bc2d76
0, 50053, 50053, 1, 115200, 0x663c467a 0, 50053, 50053, 0, 115200, 0x663c467a
0, 50597, 50597, 1, 115200, 0xd085e950 0, 50597, 50597, 0, 115200, 0xd085e950
0, 51520, 51520, 1, 115200, 0x7d198d72 0, 51520, 51520, 0, 115200, 0x7d198d72
0, 52092, 52092, 1, 115200, 0x6ebacda0 0, 52092, 52092, 0, 115200, 0x6ebacda0
#tb 0: 1/1000 #tb 0: 1/1000
0, 0, 0, 1, 9216, 0xd3c106ef 0, 0, 0, 0, 9216, 0xd3c106ef
0, 100, 100, 1, 9216, 0x8871f7c2 0, 100, 100, 0, 9216, 0x8871f7c2
#tb 0: 1/1000 #tb 0: 1/1000
0, 0, 0, 1, 9216, 0xd3c106ef 0, 0, 0, 0, 9216, 0xd3c106ef
0, 100, 100, 1, 9216, 0x8871f7c2 0, 100, 100, 0, 9216, 0x8871f7c2
#tb 0: 1/1000 #tb 0: 1/1000
0, 0, 0, 1, 6144, 0x4145b7ae 0, 0, 0, 0, 6144, 0x4145b7ae
0, 100, 100, 1, 6144, 0x3b2b38de 0, 100, 100, 0, 6144, 0x3b2b38de
#tb 0: 1/1000 #tb 0: 1/1000
0, 0, 0, 1, 6144, 0x4145b7ae 0, 0, 0, 0, 6144, 0x4145b7ae
0, 100, 100, 1, 6144, 0x3b2b38de 0, 100, 100, 0, 6144, 0x3b2b38de
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
#hash: MD5 #hash: MD5
#tb 0: 1/1000 #tb 0: 1/1000
#stream#, dts, pts, duration, size, hash #stream#, dts, pts, duration, size, hash
0, 0, 0, 1, 3110400, 1e6c2e768a5107e57e6d626f0511193a 0, 0, 0, 0, 3110400, 1e6c2e768a5107e57e6d626f0511193a
0, 40, 40, 1, 3110400, 972d3e2b5ee2e3b0907218a243e4cb7d 0, 40, 40, 0, 3110400, 972d3e2b5ee2e3b0907218a243e4cb7d
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment