[Libav-user] Start time and duration questions

william keeling williamkeeling at hotmail.com
Thu May 13 21:38:36 EEST 2021


Sorry I was wrong on review both the video (H264) and audio (AAC) have the same time added to their PTS/DTS packet times.  The only frame that has the correct (from my programs point of view) is the first video frame/packet (PTS=0) and this packet only contains side data

ffprobe from start of first file:
Sorry I was wrong on review both the video (H264) and audio (AAC) have the same time added to their PTS/DTS packet times.  The only frame that has the correct (from my programs point of view) is the first video frame/packet (PTS=0) and this packet only contains side data

ffprobe from start of first file:
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=28
pos=414
flags=__
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=23
duration_time=0.023000
convergence_duration=N/A
convergence_duration_time=N/A
size=165
pos=462
flags=K_
[/PACKET]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=23
pkt_duration_time=0.023000
pkt_pos=462
pkt_size=165
sample_fmt=fltp
nb_samples=1024
channels=2
channel_layout=stereo
[/FRAME]
[PACKET]
codec_type=audio
stream_index=1
pts=23
pts_time=0.023000
dts=23
dts_time=0.023000
duration=23
duration_time=0.023000
convergence_duration=N/A
convergence_duration_time=N/A
size=172
pos=644
flags=K_
[/PACKET]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=23
pkt_pts_time=0.023000
pkt_dts=23
pkt_dts_time=0.023000
best_effort_timestamp=23
best_effort_timestamp_time=0.023000
pkt_duration=23
pkt_duration_time=0.023000
pkt_pos=644
pkt_size=172
sample_fmt=fltp
nb_samples=1024
channels=2
channel_layout=stereo
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=13673
pos=833
flags=K_
[/PACKET]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=833
pkt_size=13673
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]

ffprobe from start of second file:

[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=28
pos=414
flags=__
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=1790282
pts_time=1790.282000
dts=1790282
dts_time=1790.282000
duration=23
duration_time=0.023000
convergence_duration=N/A
convergence_duration_time=N/A
size=170
pos=462
flags=K_
[/PACKET]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=1790282
pkt_pts_time=1790.282000
pkt_dts=1790282
pkt_dts_time=1790.282000
best_effort_timestamp=1790282
best_effort_timestamp_time=1790.282000
pkt_duration=23
pkt_duration_time=0.023000
pkt_pos=462
pkt_size=170
sample_fmt=fltp
nb_samples=1024
channels=2
channel_layout=stereo
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=1796496
pts_time=1796.496000
dts=1796496
dts_time=1796.496000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=13559
pos=649
flags=K_
[/PACKET]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=1796496
pkt_pts_time=1796.496000
pkt_dts=1796496
pkt_dts_time=1796.496000
best_effort_timestamp=1796496
best_effort_timestamp_time=1796.496000
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=649
pkt_size=13559
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]

ffprobe from start of second file:

Sorry I was wrong on review both the video (H264) and audio (AAC) have the same time added to their PTS/DTS packet times.  The only frame that has the correct (from my programs point of view) is the first video frame/packet (PTS=0) and this packet only contains side data

ffprobe from start of first file:
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=28
pos=414
flags=__
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=23
duration_time=0.023000
convergence_duration=N/A
convergence_duration_time=N/A
size=165
pos=462
flags=K_
[/PACKET]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=23
pkt_duration_time=0.023000
pkt_pos=462
pkt_size=165
sample_fmt=fltp
nb_samples=1024
channels=2
channel_layout=stereo
[/FRAME]
[PACKET]
codec_type=audio
stream_index=1
pts=23
pts_time=0.023000
dts=23
dts_time=0.023000
duration=23
duration_time=0.023000
convergence_duration=N/A
convergence_duration_time=N/A
size=172
pos=644
flags=K_
[/PACKET]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=23
pkt_pts_time=0.023000
pkt_dts=23
pkt_dts_time=0.023000
best_effort_timestamp=23
best_effort_timestamp_time=0.023000
pkt_duration=23
pkt_duration_time=0.023000
pkt_pos=644
pkt_size=172
sample_fmt=fltp
nb_samples=1024
channels=2
channel_layout=stereo
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=13673
pos=833
flags=K_
[/PACKET]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=833
pkt_size=13673
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]

ffprobe from start of second file:

[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=28
pos=414
flags=__
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=1790282
pts_time=1790.282000
dts=1790282
dts_time=1790.282000
duration=23
duration_time=0.023000
convergence_duration=N/A
convergence_duration_time=N/A
size=170
pos=462
flags=K_
[/PACKET]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=1790282
pkt_pts_time=1790.282000
pkt_dts=1790282
pkt_dts_time=1790.282000
best_effort_timestamp=1790282
best_effort_timestamp_time=1790.282000
pkt_duration=23
pkt_duration_time=0.023000
pkt_pos=462
pkt_size=170
sample_fmt=fltp
nb_samples=1024
channels=2
channel_layout=stereo
[/FRAME]
[PACKET]
codec_type=video
stream_index=0
pts=1796496
pts_time=1796.496000
dts=1796496
dts_time=1796.496000
duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A
size=13559
pos=649
flags=K_
[/PACKET]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=1796496
pkt_pts_time=1796.496000
pkt_dts=1796496
pkt_dts_time=1796.496000
best_effort_timestamp=1796496
best_effort_timestamp_time=1796.496000
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=649
pkt_size=13559
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]


________________________________
From: Libav-user <libav-user-bounces at ffmpeg.org> on behalf of william keeling <williamkeeling at hotmail.com>
Sent: Wednesday, May 12, 2021 8:56 PM
To: libav-user at ffmpeg.org <libav-user at ffmpeg.org>
Subject: Re: [Libav-user] Start time and duration questions


A few more data points:

The issue is in the AAC stream. On the first file create by my program the PTS in the packets written with av_write_frame() are the same as what is in the container file (as per ffprobe) but in subsequent files a seeming random value (same value for the whole file) is add to each PTS that is passed to av_write_frame() for that file.

I hope this will make it clear to someone what I am doing wrong.


________________________________
From: william keeling
Sent: Saturday, May 8, 2021 1:32 PM
To: libav-user at ffmpeg.org <libav-user at ffmpeg.org>
Subject: Start time and duration questions


I have a program that iterative creates Flash container files with 2 streams (video h264 and audio AAC).  The format and codec contexts are allocated before and freed after each file.  Calls are made to avformat_write_header() after contexts are allocated and to av_write_trailer() before contexts are freed.

I am using 1 for AVFormatContext.start_time_realtime (since 0 will get current system time).  How do you start from 0 when muxing?

The other issue is first file shows the correct start time and duration when played thru VLC media player.  All subsequent files show a 0 start time, large duration and a black screen for a while; then the start time changes to a large start time that is correct run time below the duration and the video plays.  Any ideas what I have done wrong that is causing the wrong start and duration time and the delay in video playing but only on subsequent files?



Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210513/ba5b1547/attachment.htm>


More information about the Libav-user mailing list