Commit 43e7f079 authored by Anton Khirnov's avatar Anton Khirnov

flvenc: only write the framerate tag based on avg_frame_rate

Do not fall back on the codec timebase, since that can be anything for
VFR video.
parent cf697771
......@@ -205,8 +205,6 @@ static int flv_write_header(AVFormatContext *s)
if (s->streams[i]->avg_frame_rate.den &&
s->streams[i]->avg_frame_rate.num) {
framerate = av_q2d(s->streams[i]->avg_frame_rate);
} else {
framerate = 1 / av_q2d(s->streams[i]->codec->time_base);
}
if (video_enc) {
av_log(s, AV_LOG_ERROR,
......@@ -307,8 +305,10 @@ static int flv_write_header(AVFormatContext *s)
put_amf_string(pb, "videodatarate");
put_amf_double(pb, video_enc->bit_rate / 1024.0);
put_amf_string(pb, "framerate");
put_amf_double(pb, framerate);
if (framerate != 0.0) {
put_amf_string(pb, "framerate");
put_amf_double(pb, framerate);
}
put_amf_string(pb, "videocodecid");
put_amf_double(pb, video_enc->codec_tag);
......
62c3177547fb5853a5116661802e1ae2 *./tests/data/lavf/lavf.flv
329541 ./tests/data/lavf/lavf.flv
52ca9477330765fee525941c5a30dad1 *./tests/data/lavf/lavf.flv
329521 ./tests/data/lavf/lavf.flv
./tests/data/lavf/lavf.flv CRC=0x881785d1
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 31074
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 31074
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 31074
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 31074
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret:-1 st: 0 flags:1 ts:-0.317000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret: 0 st: 0 flags:0 ts: 0.365000
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149441 size: 31125
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149421 size: 31125
ret:-1 st: 0 flags:1 ts:-0.741000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret: 0 st: 0 flags:0 ts:-0.058000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 31074
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 31074
ret: 0 st: 0 flags:1 ts: 2.836000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret:-1 st:-1 flags:0 ts: 1.730004
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149441 size: 31125
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149421 size: 31125
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 31074
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 31074
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret:-1 st:-1 flags:0 ts: 1.306672
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 31074
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 31074
ret: 0 st: 0 flags:0 ts:-0.905000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 31074
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 31074
ret: 0 st: 0 flags:1 ts: 1.989000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.672000
ret: 0 st: 0 flags:1 ts: 1.566000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298383 size: 31134
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149441 size: 31125
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149421 size: 31125
ret:-1 st:-1 flags:1 ts:-0.645825
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size:240757
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size:240757
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size:240757
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size:240757
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:11605762 size:254053
ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:11605742 size:254053
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:4820517 size:245503
ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:4820497 size:245503
ret:-1 st: 0 flags:1 ts:-0.317000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:8811911 size:253041
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:8811891 size:253041
ret: 0 st: 0 flags:0 ts: 0.365000
ret: 0 st: 0 flags:1 dts: 0.400000 pts: 0.400000 pos:2387452 size:241101
ret: 0 st: 0 flags:1 dts: 0.400000 pts: 0.400000 pos:2387432 size:241101
ret:-1 st: 0 flags:1 ts:-0.741000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:6302834 size:248927
ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:6302814 size:248927
ret: 0 st: 0 flags:0 ts:-0.058000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size:240757
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size:240757
ret: 0 st: 0 flags:1 ts: 2.836000
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114712 size:254237
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114692 size:254237
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.760000 pts: 1.760000 pos:10843576 size:253913
ret: 0 st: 0 flags:1 dts: 1.760000 pts: 1.760000 pos:10843556 size:253913
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.600000 pts: 0.600000 pos:3598805 size:243372
ret: 0 st: 0 flags:1 dts: 0.600000 pts: 0.600000 pos:3598785 size:243372
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size:240757
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size:240757
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114712 size:254237
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114692 size:254237
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:8053716 size:252195
ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:8053696 size:252195
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:1187821 size:238567
ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:1187801 size:238567
ret: 0 st: 0 flags:0 ts:-0.905000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size:240757
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size:240757
ret: 0 st: 0 flags:1 ts: 1.989000
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114712 size:254237
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114692 size:254237
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.920000 pts: 0.920000 pos:5559238 size:247341
ret: 0 st: 0 flags:1 dts: 0.920000 pts: 0.920000 pos:5559218 size:247341
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.672000
ret: 0 st: 0 flags:1 ts: 1.566000
ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:9572247 size:254219
ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:9572227 size:254219
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:2870253 size:242377
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:2870233 size:242377
ret:-1 st:-1 flags:1 ts:-0.645825
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 10380
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 10380
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 10380
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 10380
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83240 size: 12295
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83220 size: 12295
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 52585 size: 11127
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 52565 size: 11127
ret:-1 st: 0 flags:1 ts:-0.317000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83240 size: 12295
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83220 size: 12295
ret: 0 st: 0 flags:0 ts: 0.365000
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25960 size: 10089
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25940 size: 10089
ret:-1 st: 0 flags:1 ts:-0.741000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 52585 size: 11127
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 52565 size: 11127
ret: 0 st: 0 flags:0 ts:-0.058000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 10380
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 10380
ret: 0 st: 0 flags:1 ts: 2.836000
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117138 size: 12730
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117138 size: 12730
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25960 size: 10089
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25940 size: 10089
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 10380
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 10380
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117138 size: 12730
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83240 size: 12295
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83220 size: 12295
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 10380
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 10380
ret: 0 st: 0 flags:0 ts:-0.905000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 199 size: 10380
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 179 size: 10380
ret: 0 st: 0 flags:1 ts: 1.989000
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117138 size: 12730
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 52585 size: 11127
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 52565 size: 11127
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.672000
ret: 0 st: 0 flags:1 ts: 1.566000
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83240 size: 12295
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83220 size: 12295
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25960 size: 10089
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25940 size: 10089
ret:-1 st:-1 flags:1 ts:-0.645825
97894502b4cb57aca1105b6333f72dae *tests/data/fate/vsynth1-flashsv.flv
14681925 tests/data/fate/vsynth1-flashsv.flv
19901e7be932c65efd46449687db4572 *tests/data/fate/vsynth1-flashsv.flv
14681905 tests/data/fate/vsynth1-flashsv.flv
947cb24ec45a453348ae6fe3fa278071 *tests/data/fate/vsynth1-flashsv.out.rawvideo
stddev: 2.85 PSNR: 39.03 MAXDIFF: 49 bytes: 7603200/ 7603200
d6a80659cedee7698aefe9c4a8285fa4 *tests/data/fate/vsynth1-flv.flv
636269 tests/data/fate/vsynth1-flv.flv
615daf949171f5ce2ca9f3fd2a78b9b3 *tests/data/fate/vsynth1-flv.flv
636249 tests/data/fate/vsynth1-flv.flv
5ab46d8dd01dbb1d63df2a84858a4b05 *tests/data/fate/vsynth1-flv.out.rawvideo
stddev: 8.02 PSNR: 30.04 MAXDIFF: 105 bytes: 7603200/ 7603200
0667077971e0cb63b5f49c580006e90e *tests/data/fate/vsynth2-flashsv.flv
12368953 tests/data/fate/vsynth2-flashsv.flv
ce94a90c07434a4ebcbcab70ea69c17c *tests/data/fate/vsynth2-flashsv.flv
12368933 tests/data/fate/vsynth2-flashsv.flv
592b3321994e26a990deb3a0a1415de9 *tests/data/fate/vsynth2-flashsv.out.rawvideo
stddev: 0.65 PSNR: 51.84 MAXDIFF: 14 bytes: 7603200/ 7603200
2edc92093d36506bcc0a5c0e17e86113 *tests/data/fate/vsynth2-flv.flv
131360 tests/data/fate/vsynth2-flv.flv
9a24ba8cf7fe6c20c586a00b371eeb0b *tests/data/fate/vsynth2-flv.flv
131340 tests/data/fate/vsynth2-flv.flv
8999c8264fb0941561f64c4a736e9d88 *tests/data/fate/vsynth2-flv.out.rawvideo
stddev: 5.33 PSNR: 33.59 MAXDIFF: 80 bytes: 7603200/ 7603200
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