我怎样才能捕捉ffmpeg的音频和视频simultenaous从USB捕获设备 [英] How can I capture audio AND video simultenaous with ffmpeg from an USB capture device
问题描述
我通过USB德国坦克Grabster AV350(这是基于em2860芯片)来捕捉视频。
I'm capturing a video by means of an USB Terratec Grabster AV350 (which is based on the em2860 chip).
我没有成功时,更是打出了让音频。如果我玩的是捕获的视频与VLC或ffplay我只有3秒声音,然后将视频剩下一片寂静......
I don't succeed to get the audio when it is played . If I play the captured video with vlc or with ffplay I got only 3 seconds sound and then a silence for the rest of the video ...
在捕捉我没有得到任何错误。在结束它表明视频和音频捕获的大小....
During the capturing I don't get any errors. At the end it indicates the size of the video and audio captured ....
我使用FFmpeg的命令是:
I'm using the ffmpeg command for this :
的的ffmpeg -f ALSA -ac 2 -i HW:3 -f video4linux2 -i的/ dev / video0的-a codeC AC3 -AB 128K -v codeC MPEG4 -b 6000K -r 25 test5.avi 的
日志是:
[alsa @ 0x9bcd420]Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:3':
Duration: N/A, start: 69930.998994, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[video4linux2 @ 0x9bf5d30]Estimating duration from bitrate, this may be inaccurate
Input #1, video4linux2, from '/dev/video0':
Duration: N/A, start: 1307111377.654173, bitrate: -2147483 kb/s
Stream #1.0: Video: rawvideo, yuyv422, 720x576, -2147483 kb/s, 1000k tbr, 1000k tbn, 1000k tbc
[ac3 @ 0x9bf9590]No channel layout specified. The encoder will guess the layout, but it might be incorrect.
Output #0, avi, to 'test5.avi':
Metadata:
ISFT : Lavf52.64.2
Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 6000 kb/s, 25 tbn, 25 tbc
Stream #0.1: Audio: ac3, 44100 Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #1.0 -> #0.0
Stream #0.0 -> #0.1
Press [q] to stop encoding
frame= 1283 fps= 25 q=2.3 Lsize= 38677kB time=51.32 bitrate=6173.9kbits/s
**video:37755kB audio:846kB** global headers:0kB muxing overhead 0.198922%
如果我减少命令只捕获音频,然后将音频文件可以成功地扮演了:
If I reduce the command for only capturing audio, then the audio file can be played successfully :
的的ffmpeg -f ALSA -ac 2 -i HW:3,0 -a codeC AC3 -AB 128K test5.avi 的
[alsa @ 0x8ede420]Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:3,0':
Duration: N/A, start: 70395.998935, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[ac3 @ 0x8eebac0]No channel layout specified. The encoder will guess the layout, but it might be incorrect.
Output #0, avi, to 'test5.avi':
Metadata:
ISFT : Lavf52.64.2
Stream #0.0: Audio: ac3, 44100 Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 227kB time=13.62 bitrate= 136.8kbits/s
**video:0kB audio:213kB** global headers:0kB muxing overhead 6.902375%
如果我跑只有视频采集,然后VLC或ffplay可以顺利播放视频的命令:
If I run the command for only video capturing then vlc or ffplay can play the video successfully :
的的ffmpeg -f video4linux2 -i的/ dev / video0的-v codeC MPEG4 -b 12000K -r 25 test5.avi 的
[video4linux2 @ 0x91d6420]Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2, from '/dev/video0':
Duration: N/A, start: 1307112044.025687, bitrate: -2147483 kb/s
Stream #0.0: Video: rawvideo, yuyv422, 720x576, -2147483 kb/s, 1000k tbr, 1000k tbn, 1000k tbc
Output #0, avi, to 'test5.avi':
Metadata:
ISFT : Lavf52.64.2
Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 12000 kb/s, 25 tbn, 25 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 388 fps= 25 q=2.0 Lsize= 12963kB time=15.52 bitrate=6842.5kbits/s
**video:12949kB audio:0kB** global headers:0kB muxing overhead 0.114584%
奇怪的行为,我注意到的是,当我试图捕捉视频和音频,我无法捕捉到声音后更多,
除非我先拔掉AV350。
Strange behaviour I noticed is that when I tried capturing video and audio, I can not capture the audio afterwards any more, unless I unplug the AV350 first.
G350是位于卡3:
The G350 is located at card 3 :
htpc@htpc-01:/proc/asound/G350/pcm0c$ more info
card: 3
device: 0
subdevice: 0
stream: CAPTURE
id: USB Audio
name: USB Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
操作系统是Linux 2.6.38-8泛型与Ubuntu的纳蒂独角鲸版
The OS is a Linux 2.6.38-8-generic with the Ubuntu Natty Narwhal version
如何解决这一问题将是巨大的任何帮助......
Any help on how to tackle this issue would be great ....
谢谢!
推荐答案
它适用于高品质的视频:
It works for high quality video:
ffmpeg -f alsa -ac 2 -i hw:1,0 -f video4linux2 -i /dev/video0 -acodec ac3 -ab
128k -f matroska -s 1280x720 -vcodec libx264 -preset ultrafast -qp 16 testsize.mkv
这篇关于我怎样才能捕捉ffmpeg的音频和视频simultenaous从USB捕获设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!