Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 2/3] lavf/mkvtimestamp_v2: review implementation to match mkvextract behavior
Date: Mon, 22 Apr 2024 18:48:18 +0200
Message-ID: <AS8P250MB0744B71D45D3EE342B8356778F122@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <ZiZsNhuYEGA7Yllo@mariano>

Stefano Sabatini:
> On date Saturday 2024-04-20 18:47:58 +0200, Andreas Rheinhardt wrote:
>> Stefano Sabatini:
> [...]
>>>> 1. This does not match mkvextract behaviour. mkvextract does not force a
>>>> 1ms timebase.
>>>
>>> From your past comment:
>>>> The accuracy of the timestamps output by mkvextract is determined by the
>>>> TimestampScale of the file in question; it is most often 1ms when the
>>>> file has video.
>>>
>>
>> "most often" != "force"
> [...]
> 
>> (I am not certain wrt MKVToolNix handling of fractional millisecond; old
>> versions of mkvextract may really have simply rounded/truncated to
>> milliseconds.)
> 
> It doesn't, at least with version:
> $ mkvextract --version
> mkvextract v65.0.0 ('Too Much') 64-bit
> 

With old I actually meant really old. As old as this muxer.

> So far, mkvextract seems to output DTSs as in the original
> implementation - therefore no need to change implementation, but for
> the "timecode" => "timestamp" issue.
> 

What is the TimestampScale of said file? Given that we are dealing with
a video stream it is highly likely to be 1ms, so that there will be no
difference.

The following is from a 44100Hz with 4608 samples per packet and a
TimestampScale of 22674 (equivalent to a timebase of 22674/1000000000 s).

$ mkvextract fl.mka timestamps_v2 0:fl.txt
Progress: 100%
$ head -n 7 fl.txt
# timestamp format v2
0
104.489795
208.97959
313.469385
417.95918
522.448975

(The following is with the current implementation, but your suggested
patch won't change anything for it.)

$ ./ffmpeg -i fl.mka -map 0:a -c copy -f mkvtimestamp_v2 - 2>/dev/null |
head -7
# timecode format v2
0
104
209
313
418
522

$ ./ffprobe -hide_banner fl.mka -of csv=nk=1:p=0 -select_streams a:0
-show_entries packet=pts 2>/dev/null | head -n 6
0
4608
9216
13824
18433
23041

$ ./ffprobe -hide_banner fl.mka -of csv=nk=1:p=0 -select_streams a:0
-show_entries packet=pts_time 2>/dev/null | head -n 6
0.000000
0.104482
0.208964
0.313445
0.417950
0.522432

(The slight differences here with mkvextract is due to lacing:
mkvextract calculates the timestamps of the non-leading packets in a
lace with the default duration and uses nanosecond precision for this.)

> $ ./ffprobe -hide_banner slow.mkv -of csv=nk=1:p=0 -select_streams v:0 -show_entries packet=pts  | head -n 20 
> [...]
> 0
> 1201
> 1235
> 1268
> 1368
> 1301
> 1335
> 1401
> 1435
> 1535
> 1468
> 1502
> 1602
> 1568
> 1735
> 1668
> 1635
> 1702
> 1768
> 1869
> 
> $ ./ffprobe -hide_banner slow.mkv -of csv=nk=1:p=0 -select_streams v:0 -show_entries packet=dts  | head -n 20 
> N/A
> N/A
> 0
> 1201
> 1235
> 1268
> 1301
> 1335
> 1368
> 1401
> 1435
> 1468
> 1502
> 1535
> 1568
> 1602
> 1635
> 1668
> 1702
> 1735
> 
> $ mkvextract slow.mkv timestamps_v2 0:slow.mkv.out
> Progress: 100%
> $ head -n 21 slow.mkv.out 
> # timestamp format v2
> 0
> 1201
> 1235
> 1268
> 1301
> 1335
> 1368
> 1401
> 1435
> 1468
> 1502
> 1535
> 1568
> 1602
> 1635
> 1668
> 1702
> 1735
> 1768
> 1802

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-04-22 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20 11:48 [FFmpeg-devel] lavf/mkvtimestamp_v2: review mkvtimestamp_v2 implementation, add documentation Stefano Sabatini
2024-04-20 11:48 ` [FFmpeg-devel] [PATCH 1/3] lavf/mkvtimestamp_v2: use name in place of description in long name Stefano Sabatini
2024-04-20 11:48 ` [FFmpeg-devel] [PATCH 2/3] lavf/mkvtimestamp_v2: review implementation to match mkvextract behavior Stefano Sabatini
2024-04-20 13:18   ` Andreas Rheinhardt
2024-04-20 16:00     ` Stefano Sabatini
2024-04-20 16:47       ` Andreas Rheinhardt
2024-04-20 16:56         ` Stefano Sabatini
2024-04-22 13:55         ` Stefano Sabatini
2024-04-22 16:48           ` Andreas Rheinhardt [this message]
2024-04-20 11:48 ` [FFmpeg-devel] [PATCH 3/3] doc/muxers: add mkvtimestamp_v2 Stefano Sabatini
2024-04-20 11:53   ` Stefano Sabatini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744B71D45D3EE342B8356778F122@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git