[FFmpeg-user] Trying to write to disk the output of a USB capture card and can't combine video and audio
Geoff Sweet
mailinator at whootis.com
Thu Dec 17 10:23:12 EET 2020
Thank you for the feedback.
Interestingly, this:
[video4linux2,v4l2 @ 0x56248fe0ab80] Dequeued v4l2 buffer contains
corrupted data (0 bytes).
Appears to be my headache and I kinda discovered it by accident. I was
experimenting with some suggestions from another forum and found this
command:
ffmpeg -y -thread_queue_size 1024 -f alsa -channels 2 -i
front:CARD=Capture,DEV=0 -thread_queue_size 1024 -f video4linux2
-video_size 640x480 -i /dev/video0 -c:v libx264 -crf 0 -g 1 -c:a copy
output.mkv
Worked great. Until I ran it again and it fell on its face. It's
definitely not something in the ffmpeg space, it's the v4l2. First time
you run that command after plugging the capture device in, it runs fine
with no errors. Second time you run it you get that corrupted data
error. If I unplug the capture device, then plug it back in it appears
to reset the v4l2 device interface. Then running that command above
again produces really nice clean in-sync video. So I guess I have a
work around. I suppose I will move this over to the v4l2 folks and see
what they make of it. Looks like theres already a few threads on Google
about it.
Thanks again for the followup.
-Geoff
On 2020-12-16 22:51, Carl Eugen Hoyos wrote:
>> Am 17.12.2020 um 00:47 schrieb Geoff Sweet <mailinator at whootis.com>:
>>
>> ffmpeg -y -f alsa -ac 2 -i front:CARD=Capture,DEV=0 -f video4linux2 -i
>> /dev/video0 out.mpeg
>
> Unrelated:
> „mpeg" output will not make you happy.
>
>> But that command kinda falls on its face. I get the audio, but no
>> video:
>>
>> ffmpeg -y -f alsa -ac 2 -i front:CARD=Capture,DEV=0 -f video4linux2 -i
>> /dev/video0 out.mpeg
>> ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
>
> Please remember to test current FFmpeg git head before posting here.
>
> [...]
>
>> Input #0, alsa, from 'front:CARD=Capture,DEV=0':
>> Duration: N/A, start: 1608093176.894565, bitrate: 1536 kb/s
>> Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
>> [video4linux2,v4l2 @ 0x56248fe0ab80] Dequeued v4l2 buffer contains
>> corrupted data (0 bytes).
>> Input #1, video4linux2,v4l2, from '/dev/video0':
>> Duration: N/A, start: 0.000000, bitrate: 995328 kb/s
>
> The start times do not match, this makes recording very difficult
> because there will likely be A/V desync.
>
> Try the v4l2 input option -ts abs
> See: https://ffmpeg.org/ffmpeg-devices.html#Options-18
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list