matroskaenc: set the stream timebase earlier

Fixes calculating the ts offset for audio codecs with delay.
This commit is contained in:
Anton Khirnov 2014-05-27 10:28:24 +02:00
parent 43e7f0797f
commit 962d631573
3 changed files with 27 additions and 27 deletions

View File

@ -620,6 +620,9 @@ static int mkv_write_tracks(AVFormatContext *s)
int output_sample_rate = 0;
AVDictionaryEntry *tag;
// ms precision is the de-facto standard timescale for mkv files
avpriv_set_pts_info(st, 64, 1, 1000);
if (codec->codec_type == AVMEDIA_TYPE_ATTACHMENT) {
mkv->have_attachments = 1;
continue;
@ -759,9 +762,6 @@ static int mkv_write_tracks(AVFormatContext *s)
if (ret < 0) return ret;
end_ebml_master(pb, track);
// ms precision is the de-facto standard timescale for mkv files
avpriv_set_pts_info(st, 64, 1, 1000);
}
end_ebml_master(pb, tracks);
return 0;

View File

@ -1,3 +1,3 @@
f424aea501255b846f579e1231a99f57 *./tests/data/lavf/lavf.mkv
320381 ./tests/data/lavf/lavf.mkv
268fb8f9278b0df2f87a6a9455f3cd56 *./tests/data/lavf/lavf.mkv
320380 ./tests/data/lavf/lavf.mkv
./tests/data/lavf/lavf.mkv CRC=0xbe7d3cda

View File

@ -1,53 +1,53 @@
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.471000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320110 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320109 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146822 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146821 size: 27925
ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000
ret:-EOF
ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320110 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320109 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004
ret:-EOF
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146822 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146821 size: 27925
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 1 flags:0 ts: 1.307000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:0 ts: 0.883000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 ts:-0.222000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.566000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320110 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320109 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146822 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146821 size: 27925
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208