Commit c17e33c0 authored by Anton Khirnov's avatar Anton Khirnov

fftools/ffmpeg: propagate frame durations to packets when encoding

Remove now-obsolete code setting packet durations pre-muxing for CFR
encoded video.

Changes output in the following FATE tests:
* numerous adpcm tests
* ffmpeg-filter_complex_audio
* lavf-asf
* lavf-mkv
* lavf-mkv_attachment
* matroska-encoding-delay
  All of these change due to the fact that the output duration is now
  the actual input data duration and does not include padding added by
  the encoder.

* apng-osample: less wrong packet durations are now passed to the muxer.
  They are not entirely correct, because the first frame duration should
  be 3 rather than 2. This is caused by the vsync code and should be
  addressed later, but this change is a step in the right direction.
* tscc2-mov: last output frame has a duration of 11 rather than 1 - this
  corresponds to the duration actually returned by the demuxer.
* film-cvid: video frame durations are now 2 rather than 1 - this
  corresponds to durations actually returned by the demuxer and matches
  the timestamps.
* mpeg2-ticket6677: durations of some video frames are now 2 rather than
  1 - this matches the timestamps.
parent af286f17
......@@ -325,6 +325,8 @@ int enc_open(OutputStream *ost, AVFrame *frame)
return ret;
}
av_dict_set(&ost->encoder_opts, "flags", "+frame_duration", AV_DICT_MULTIKEY);
ret = hw_device_setup_for_encode(ost);
if (ret < 0) {
av_log(ost, AV_LOG_ERROR,
......
......@@ -76,15 +76,6 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
if (ost->type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP)
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
if (ost->type == AVMEDIA_TYPE_VIDEO) {
if (ost->frame_rate.num && ost->is_cfr) {
if (pkt->duration > 0)
av_log(ost, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n");
pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
pkt->time_base);
}
}
av_packet_rescale_ts(pkt, pkt->time_base, ost->st->time_base);
pkt->time_base = ost->st->time_base;
......
56b75c3a6dacedcf2ce7b0586aa33594 *tests/data/fate/acodec-adpcm-ima_wav.wav
af0b82a719762cc6e1a952a6081231cf *tests/data/fate/acodec-adpcm-ima_wav.wav
267324 tests/data/fate/acodec-adpcm-ima_wav.wav
78a2af1c895792d0c221d127bdd48ece *tests/data/fate/acodec-adpcm-ima_wav.out.wav
stddev: 903.51 PSNR: 37.21 MAXDIFF:34026 bytes: 1058400/ 1061748
f9075c7a3adb2cd114b0bac69afcada6 *tests/data/fate/acodec-adpcm-ima_wav-trellis.wav
6f0df0f3275f833c341d63b9054caebb *tests/data/fate/acodec-adpcm-ima_wav-trellis.wav
267324 tests/data/fate/acodec-adpcm-ima_wav-trellis.wav
26a9b280c14737b159c56e60181f1170 *tests/data/fate/acodec-adpcm-ima_wav-trellis.out.wav
stddev: 710.03 PSNR: 39.30 MAXDIFF:25944 bytes: 1058400/ 1061748
a407b87daeef5b25dfb6c5b3f519e9c1 *tests/data/fate/acodec-adpcm-ms.wav
ed29590dc005c64940c46cfe4a0e8eba *tests/data/fate/acodec-adpcm-ms.wav
268378 tests/data/fate/acodec-adpcm-ms.wav
7be370f937c51e8a967e6a3d08d5156a *tests/data/fate/acodec-adpcm-ms.out.wav
stddev: 1050.01 PSNR: 35.91 MAXDIFF:29806 bytes: 1058400/ 1060576
7ed05f7a88046aa4cd547ddf71953637 *tests/data/fate/acodec-adpcm-ms-trellis.wav
70deb036ed0bf3dd03699eafbbfa51b7 *tests/data/fate/acodec-adpcm-ms-trellis.wav
268378 tests/data/fate/acodec-adpcm-ms-trellis.wav
ed9d9cdfd264f2ec6c79127c04dd224e *tests/data/fate/acodec-adpcm-ms-trellis.out.wav
stddev: 896.03 PSNR: 37.28 MAXDIFF:28029 bytes: 1058400/ 1060576
64aedd1487cb355406dde36d2bba374f *tests/data/fate/acodec-adpcm-swf.flv
03bda567604b31c86c8740a044eedb1d *tests/data/fate/acodec-adpcm-swf.flv
267801 tests/data/fate/acodec-adpcm-swf.flv
9d061488fdc1a557bdc454b9d1aba59c *tests/data/fate/acodec-adpcm-swf.out.wav
stddev: 919.82 PSNR: 37.06 MAXDIFF:51119 bytes: 1058400/ 1064960
fde151ce9b8be0e144e72113508bcff6 *tests/data/fate/acodec-adpcm-swf-trellis.flv
83d6efddeb11bb0f0a4131a6384c7e4b *tests/data/fate/acodec-adpcm-swf-trellis.flv
267801 tests/data/fate/acodec-adpcm-swf-trellis.flv
6a0007e42d92a225a8becddedccf9a0f *tests/data/fate/acodec-adpcm-swf-trellis.out.wav
stddev: 731.05 PSNR: 39.05 MAXDIFF:51119 bytes: 1058400/ 1064960
a21ee5ba531ec89e306d78c861eb6ed1 *tests/data/fate/acodec-adpcm-swf-wav.wav
e8a4ac69e50211f3ef828d26b7051397 *tests/data/fate/acodec-adpcm-swf-wav.wav
266624 tests/data/fate/acodec-adpcm-swf-wav.wav
9d061488fdc1a557bdc454b9d1aba59c *tests/data/fate/acodec-adpcm-swf-wav.out.wav
stddev: 919.82 PSNR: 37.06 MAXDIFF:51119 bytes: 1058400/ 1064960
245c194e84d482a70ca89de9c0bbd591 *tests/data/fate/acodec-adpcm-yamaha.wav
4719ae6d28c4b13c270caefb34fde140 *tests/data/fate/acodec-adpcm-yamaha.wav
265274 tests/data/fate/acodec-adpcm-yamaha.wav
758b4aee62964831d0a335ada9672104 *tests/data/fate/acodec-adpcm-yamaha.out.wav
stddev: 1242.71 PSNR: 34.44 MAXDIFF:39960 bytes: 1058400/ 1060864
c8306ada93ef52b1e87b6758853f4937 *tests/data/fate/acodec-adpcm-yamaha-trellis.wav
6601c0c29d2ac6ed2eee94b13bc3f289 *tests/data/fate/acodec-adpcm-yamaha-trellis.wav
265274 tests/data/fate/acodec-adpcm-yamaha-trellis.wav
8ad27b0ea7e13e70ed334b5ec26c62ef *tests/data/fate/acodec-adpcm-yamaha-trellis.out.wav
stddev: 926.56 PSNR: 36.99 MAXDIFF:33570 bytes: 1058400/ 1060864
......@@ -3,9 +3,9 @@
#codec_id 0: rawvideo
#dimensions 0: 116x135
#sar 0: 0/1
0, 0, 0, 1, 62640, 0x31eb581d
0, 3, 3, 1, 62640, 0x29e11b82
0, 6, 6, 1, 62640, 0x207ed588
0, 9, 9, 1, 62640, 0x3845c906
0, 12, 12, 1, 62640, 0x6797fe69
0, 15, 15, 1, 62640, 0x1f086a09
0, 0, 0, 2, 62640, 0x31eb581d
0, 3, 3, 3, 62640, 0x29e11b82
0, 6, 6, 3, 62640, 0x207ed588
0, 9, 9, 3, 62640, 0x3845c906
0, 12, 12, 3, 62640, 0x6797fe69
0, 15, 15, 3, 62640, 0x1f086a09
e432aa783e79208a61052f6ced525fff *tests/data/fate/autorotate.mov
197358 tests/data/fate/autorotate.mov
701a366a5b97ea92b0e25f5d059a0dd6 *tests/data/fate/autorotate.mov
197366 tests/data/fate/autorotate.mov
#extradata 0: 34, 0x9d7d073f
#tb 0: 1/15360
#media_type 0: video
......
......@@ -6,4 +6,4 @@
0, -256, -256, 1536, 416, 0x3001fb2d
0, 1280, 1280, 1536, 418, 0xba72fc16
0, 2816, 2816, 1536, 418, 0xba72fc16
0, 4352, 4352, 1536, 418, 0xba72fc16
0, 4352, 4352, 3, 418, 0xba72fc16
This diff is collapsed.
ce2ab14d45217a043f9f50fe6adfe5ce *tests/data/fate/matroska-encoding-delay.matroska
416f35d123daef715b7c4bbb75c9c778 *tests/data/fate/matroska-encoding-delay.matroska
961251 tests/data/fate/matroska-encoding-delay.matroska
#extradata 0: 22, 0x32ea0490
#tb 0: 1/1000
......
......@@ -4,9 +4,9 @@
#dimensions 0: 720x480
#sar 0: 8/9
0, 1, 1, 1, 518400, 0xc1866f5f
0, 2, 2, 1, 518400, 0x9ba32764
0, 2, 2, 2, 518400, 0x9ba32764
0, 4, 4, 1, 518400, 0xa9031bb8
0, 5, 5, 1, 518400, 0x5e2c3502
0, 6, 6, 1, 518400, 0xe860027a
0, 7, 7, 1, 518400, 0xa9152430
0, 7, 7, 2, 518400, 0xa9152430
0, 9, 9, 1, 518400, 0xb98dd9f7
......@@ -7,4 +7,4 @@
0, 1, 1, 1, 1180116, 0x6f73e080
0, 2, 2, 1, 1180116, 0x5244d9e5
0, 3, 3, 1, 1180116, 0x629bf10f
0, 4, 4, 1, 1180116, 0x97c726cb
0, 4, 4, 11, 1180116, 0x97c726cb
76f131a5426f0ba5fc7409d1a1bbfdd7 *tests/data/lavf/lavf.asf
776cd99d73857d4ef824e3936c6a0932 *tests/data/lavf/lavf.asf
333585 tests/data/lavf/lavf.asf
tests/data/lavf/lavf.asf CRC=0xf6340a10
fde4f0580865684b878f0e13997213af *tests/data/lavf/lavf.mkv
1dce6c32d49a8f637262db2d8e7f2744 *tests/data/lavf/lavf.mkv
320439 tests/data/lavf/lavf.mkv
tests/data/lavf/lavf.mkv CRC=0xec6c3c68
c75c844f592d44c2a79ff5fc1e8179e0 *tests/data/lavf/lavf.mkv_attachment
140ffb4f6a734972a9d38f4e6d57f304 *tests/data/lavf/lavf.mkv_attachment
472589 tests/data/lavf/lavf.mkv_attachment
tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
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