[FFmpeg-user] strange pts in v4l2 capture
Casey Connor
ffmpeg at caseyconnor.org
Mon Nov 18 21:52:49 EET 2024
Hi - I am capturing to an .avi file in linux, and the resulting file has
stuttering audio. If I demux the streams (1 video and 1 stereo audio)
they play fine on their own.
If I simply remux the broken file like this:
ffmpeg -i test.avi -c:a copy -c:v copy test-remuxed.avi
...the "remuxed" version plays fine. If I compare the pts in the broken
vs. remuxed file using ashowinfo, I notice something: the audio pts
values don't match the nb_samples -- instead they are 4x larger. E.g.
for the first line see how 1024 nb_samples causes the next pts to be
4096, and for the next line nb_samples:256 increases pts to 5120, and so on:
Broken file:
[Parsed_ashowinfo_0 @ 0x70654c002f80] n:0 pts:0 pts_time:0 fmt:s16
channels:2 chlayout:stereo rate:48000 nb_samples:1024 checksum:73F22CAC
plane_checksums: [ 73F22CAC ]
[Parsed_ashowinfo_0 @ 0x70654c002f80] n:1 pts:4096 pts_time:0.0853333
fmt:s16 channels:2 chlayout:stereo rate:48000 nb_samples:256
checksum:929680FC plane_checksums: [ 929680FC ]
[Parsed_ashowinfo_0 @ 0x70654c002f80] n:2 pts:5120 pts_time:0.106667
fmt:s16 channels:2 chlayout:stereo rate:48000 nb_samples:1024
checksum:7A55BBD5 plane_checksums: [ 7A55BBD5 ]
With the working remuxed file, the next pts is simply the previous pts +
nb_samples:
[Parsed_ashowinfo_0 @ 0x76a788002f80] n:0 pts:0 pts_time:0 fmt:s16
channels:2 chlayout:stereo rate:48000 nb_samples:1024 checksum:73F22CAC
plane_checksums: [ 73F22CAC ]
[Parsed_ashowinfo_0 @ 0x76a788002f80] n:1 pts:1024 pts_time:0.0213333
fmt:s16 channels:2 chlayout:stereo rate:48000 nb_samples:256
checksum:929680FC plane_checksums: [ 929680FC ]
[Parsed_ashowinfo_0 @ 0x76a788002f80] n:2 pts:1280 pts_time:0.0266667
fmt:s16 channels:2 chlayout:stereo rate:48000 nb_samples:1024
checksum:7A55BBD5 plane_checksums: [ 7A55BBD5 ]
I'm using ffmpeg version 7.0.2-3ubuntu1 on Kubuntu 24.10. I'm capturing
720x480 NTSC_M from a Hauppauge USB-Live2 S/Video capture card (cs231xx
driver) like this:
ffmpeg -f alsa -ac 2 -i hw:CARD=Cx231xxAudio,DEV=0 -f v4l2 -i
/dev/video2 -c:a copy -c:v rawvideo test.avi
Also note: when capturing I get numerous errors like these:
[vost#0:0/rawvideo @ 0x55f451f6b280] Clipping frame in rate conversion
by 0.011955
[aost#0:1/copy @ 0x55f451f75440] Non-monotonic DTS; previous: 29662,
current: 29564; changing to 29663. This may result in incorrect
timestamps in the output file.
Thanks in advance for any ideas!
-c
More information about the ffmpeg-user
mailing list