[FFmpeg-user] Setting -output_ts_offset always adds 2 frames

Gyan ffmpeg at gyani.pro
Fri Feb 8 09:13:48 EET 2019



On 07-02-2019 03:47 AM, Julien De Luca wrote:
> Hello all,
>
> I'm trying to set the initial pkt_pts_time using output_ts_offset. On
> streams encoded using ffmpeg, it always sets the offset + 0.08s, which is 2
> frames. Here is the command I use :
>
> ```
> ffmpeg -i input.ts -acodec aac -vcodec libx264 -f mpegts -preset veryfast
> -filter:v scale=640:-1 -framerate 25 -profile:v main -b:v 1200000 -level
> 3.1 -b:a 96000 -g 75 -bf 3 -output_ts_offset 10 -muxdelay 0 -muxpreload 0
> output.ts
> ```
>
> And the output from ffprobe for the first video frame :
> ```
> {
>    "media_type": "video",
>    "stream_index": 0,
>    "key_frame": 1,
>    "pkt_pts": 907200,
>    "pkt_pts_time": "10.080000",
>    "pkt_dts": 907200,
>    "pkt_dts_time": "10.080000",
>    "best_effort_timestamp": 907200,
>    "best_effort_timestamp_time": "10.080000",
>    "pkt_duration": 3600,
>    "pkt_duration_time": "0.040000",
>    "pkt_pos": "1128",
>    "pkt_size": "4872",
>    "width": 640,
>    "height": 360,
>    "pix_fmt": "yuv420p",
>    "sample_aspect_ratio": "1:1",
>    "pict_type": "I",
>    "coded_picture_number": 0,
>    "display_picture_number": 0,
>    "interlaced_frame": 0,
>    "top_field_first": 0,
>    "repeat_pict": 0,
>    "chroma_location": "left"
> }
> ```
>
> The input is a ts file from a segmented stream created using hls options of
> ffmpeg.
>
> On another input created using AWS Mediaconvert, pkt_pts_time is set
> correctly, at exactly 10.
>
> Is there any known reason this may happen ?
>

What's the output with

ffmpeg -i input.ts -an -vcodec libx264 -f mpegts -preset veryfast
-filter:v scale=640:-1 -profile:v main -b:v 1200000 -level
3.1 -g 75 -bf 3 -output_ts_offset 10 -muxdelay 0 -muxpreload 0
output.ts

Gyan



More information about the ffmpeg-user mailing list