[FFmpeg-devel] [PATCH] added parameter to dash encoder for start available time
Jan Ekström
jeebjp at gmail.com
Thu Mar 18 23:52:54 EET 2021
On Thu, Mar 18, 2021 at 5:07 PM Jan Ekström <jeebjp at gmail.com> wrote:
>
> On Thu, Mar 18, 2021, 17:01 Gyan Doshi <ffmpeg at gyani.pro> wrote:
>>
>>
>>
>> On 2021-03-18 20:12, Jan Ekström wrote:
>> > So right now we do have an option in ffmpeg.c called itsoffset. It
>> > lets you configure the input offset in time (seconds - such as
>> > "1337.123" or time format - such as "00:00:01.123"). The only problem
>> > with it right now is that unless you set -copyts it will not get
>> > applied for anything else than subtitles, as the offset gets applied
>> > before and is not taken into account in the "start from PTS 0"
>> > calculation for video/audio streams.
>>
>> Not the case.
>>
>> ffmpeg -f lavfi -itsoffset 3 -i nullsrc=r=1:d=3 -vf showinfo -f null -
>>
>> gives
>>
>> [Parsed_showinfo_0 @ 0000019cc1b88540] n: 0 pts: 3 pts_time:3 ...
>> [Parsed_showinfo_0 @ 0000019cc1b88540] n: 1 pts: 4 pts_time:4 ...
>> [Parsed_showinfo_0 @ 0000019cc1b88540] n: 2 pts: 5 pts_time:5 ...
>>
>> I've used it many times to adjust sync among streams.
>>
>> Regards,
>> Gyan
>
>
> Very interesting!
>
> I will have to retest, I just recall that the last time I tried it got applied when there were multiple streams in an input when the start_time based adjustment was done.
Right, so taking in a Matroska file it works fine, but when taking in
an MPEG-TS file with a start_time it not only transforms (start_time +
input_ts_offset) to (input_ts_offset), but just to 0 :) .
Example:
ffmpeg -v verbose -debug_ts -itsoffset "1616090389" -i
'https://megumin.fushizen.eu/samples/switchingaudio.ts' -c copy -bsf:a
aac_adtstoasc -movflags dash+frag_discont+delay_moov -vframes 5 -f mp4
- > test.mp4
Probed start_time:
Duration: 00:00:15.25, start: 19516.478644, bitrate: 23823 kb/s
And how ffmpeg.c then adjusted it:
demuxer -> ist_index:2 type:audio next_dts:NOPTS next_dts_time:NOPTS
next_pts:NOPTS next_pts_time:NOPTS pkt_pts:1756483078
pkt_pts_time:19516.5 pkt_dts:1756483078 pkt_dts_time:19516.5
off:1616070872521356 off_time:1.61607e+09
demuxer+ffmpeg -> ist_index:2 type:audio pkt_pts:0 pkt_pts_time:0
pkt_dts:0 pkt_dts_time:0 off:-19516478644 off_time:-19516.5
Thus, ffmpeg.c is not only adjusting the timestamp to start at zero
with the start_time, but also takes the itsoffset off as well.
Best regards,
Jan
More information about the ffmpeg-devel
mailing list