[FFmpeg-user] Wrong PTS and DTS when grabbing video from webcam
Manuel Tonella
manuel.concorsi at gmail.com
Wed Jan 11 16:29:54 EET 2017
Hi everybody,
I'm using ffmpeg to capture video from a webcam (H264 source) and save it
in a container (MP4) without re-encoding.
Often I get wrong frame timestamp in output video, so it starts not from
0(zero) but from the "machine uptime"(something like 16hrs...).
What I need is that the output video should start with 0 timestamp,
is there some options about that ?.
Platform: ARM
Linux: 3.16
Webcam: Sonix SN9C292
Driver: UVC
Below my command line:
ffmpeg
-probesize 32 -rtbufsize 10000k -pix_fmt yuv420p -r ${FPS} -s ${W}x${H}
-framerate ${FPS} -vcodec h264 -f v4l2 -i /dev/video1 -vcodec copy
-r ${FPS} -reset_timestamps 1 -frag_duration 1000000 -movflags
empty_moov+omit_tfhd_offset+frag_keyframe+default_base_moof
-f MP4 -y ${FILENAME}
Below the output of ffprobe (with -show_frame option)
As you can see the first frame has pkt_pts_time = 0, the second frame has
pkt_pts_time=59676.907910
[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=984
pkt_size=36747
width=1280
height=720
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
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=611091537
pkt_pts_time=59676.907910
pkt_dts=611091537
pkt_dts_time=59676.907910
best_effort_timestamp=611091537
best_effort_timestamp_time=59676.907910
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=37919
pkt_size=18482
width=1280
height=720
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=P
coded_picture_number=1
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
[FRAME]
ffprobe version N-78067-g9079e99 Copyright (c) 2007-2016 the FFmpeg
developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --enable-libmodplug --enable-libm
p3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvidstab --ena
ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-lzma --enable-decklink --enable-z
lib
libavutil 55. 15.100 / 55. 15.100
libavcodec 57. 22.102 / 57. 22.102
libavformat 57. 23.100 / 57. 23.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 27.100 / 6. 27.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000005f6100] decoding for stream 0 failed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1484126232.663.mkv':
Metadata:
major_brand : iso5
minor_version : 512
compatible_brands: iso6mp41
encoder : Lavf56.40.101
- CBRVBR: 2
Duration: 16:37:03.92, start: 0.000000, bitrate: 2 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1280x720, 2 kb/s, 0.02 fps, 10240 tbr, 10240 tbn,
20480 tbc (default)
Metadata:
handler_name : VideoHandler
[h264 @ 0000000000609ca0] AVC: nal size 44498
Last message repeated 1 times
[h264 @ 0000000000609ca0] no frame!
Thank you
More information about the ffmpeg-user
mailing list