[FFmpeg-user] find frames/images

Louis Letourneau lletourn49 at gmail.com
Wed Nov 17 23:26:19 EET 2021


Not sure if this has been answered before or if I should post to devel
instead, but here goes.
I have a vfr video
I reencode the vfr in cfr
ffmpeg -i INPUT -codec:a aac -b:a 128k -codec:v libx264 -crf 23 -vf
"pad=width=3840:height=2160:x=0:y=312:color=black,scale=-1:720,fps=30"
-preset fast -pix_fmt yuvj420p -bf 0 -hls_time 5 -hls_list_size 0
-hls_playlist_type event -hls_wrap 0 -hls_segment_filename
"out/out_%04d.ts" out/out.m3u8

using ffprobe I see the first frame of the src and dest has different pts
src (vfr)
[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=2970
pkt_duration_time=0.033000
pkt_pos=48
pkt_size=211388
width=3840
height=1536
...
[/FRAME]

dest (cfr)
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=131760
pkt_pts_time=1.464000
pkt_dts=131760
pkt_dts_time=1.464000
best_effort_timestamp=131760
best_effort_timestamp_time=1.464000
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=564
pkt_size=100369
width=1280
height=720
...
[/FRAME]



Extracting frames and overlaying pts
ffmpeg -i VIDEO -an -filter_complex
"drawtext=fontsize=(h/30):fontfile=/usr/share/fonts/truetype/ubuntu/UbuntuMono-B.ttf:
text='%{pts}': x=600 : y=360 : box=1" -f image2 -vsync 0 -start_number 0 -t
00:00:35 b/b_%09d.png

Shows on the first image that pts is 0.0000 for both vfr and cfr videos

Whether I use vsync or not even though in the dest video, the first pts is
pkt_pts_time=1.464000

What am I missing?

Also I checked the container start:
ffprobe -show_format VIDEO
[FORMAT]
filename=VIDEO
nb_streams=2
nb_programs=1
format_name=hls
format_long_name=Apple HTTP Live Streaming
start_time=1.400000
duration=4595.033333
size=30475
bit_rate=53
probe_score=100
[/FORMAT]


start_time is 1.400000

even so
1.464000 - 1.40000 = 0.064000
not 0.0000

?!
Thanks
Louis


More information about the ffmpeg-user mailing list