ffmpeg录制usb摄像头和alsa音频出现ALSA buffer xrun.

2017-11-29 12:48:11来源:CSDN作者:Aexisun人点击

分享

参考解决办法https://stackoverflow.com/questions/28359855/alsa-buffer-xrun-induced-by-low-quality-source-in-ffmpeg-capture

添加-thread_queue_size 1024选项来解决这个问题

ffmpeg  -f alsa  -thread_queue_size 1024 -i hw:0   -f v4l2  -video_size 640x480 -i /dev/video15 -pix_fmt yuyv422   -t 10 test.avi

[root@FriendlyARM /]# [root@FriendlyARM /]# [root@FriendlyARM /]# rm test.avi [root@FriendlyARM /]# ffmpeg  -f alsa  -thread_queue_size 1024 -i hw:0   -f v4l2  -video_size 640x480 -i /dev/video15 -pix_fmt yuv420p   -t 10 test.aviffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers  built with gcc 4.5.1 (ctng-1.8.1-FA)  configuration: --cross-prefix=arm-linux- --enable-cross-compile --target-os=linux --cc=arm-linux-gcc --arch=arm --prefix=/home/tiny4412/ffmpeg/ --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libx264 --enable-ffmpeg --disable-ffplay --enable-ffserver --enable-swscale --enable-pthreads --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-yasm --disable-stripping --extra-cflags=-I/home/tiny4412/ffmpeg/x264/include --extra-ldflags=-L/home/tiny4412/ffmpeg/x264/lib  WARNING: library configuration mismatch  avdevice    configuration: --cross-prefix=arm-linux- --enable-cross-compile --target-os=linux --cc=arm-linux-gcc --arch=arm --prefix=/ffmpeg --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libx264 --enable-ffmpeg --disable-ffplay --enable-ffserver --enable-swscale --enable-pthreads --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-stripping --extra-cflags=-I/x264-asm/include --extra-ldflags=-L/x264-asm/lib  postproc    configuration: --cross-prefix=arm-linux- --enable-cross-compile --target-os=linux --cc=arm-linux-gcc --arch=arm --prefix=/ffmpeg --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libx264 --enable-ffmpeg --disable-ffplay --enable-ffserver --enable-swscale --enable-pthreads --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-stripping --extra-cflags=-I/x264-asm/include --extra-ldflags=-L/x264-asm/lib  libavutil      55. 78.100 / 55. 78.100  libavcodec     57.107.100 / 57.107.100  libavformat    57. 83.100 / 57. 83.100  libavdevice    57. 10.100 / 57. 10.100  libavfilter     6.107.100 /  6.107.100  libswscale      4.  8.100 /  4.  8.100  libswresample   2.  9.100 /  2.  9.100  libpostproc    54.  7.100 / 54.  7.100Guessed Channel Layout for Input Stream #0.0 : stereoInput #0, alsa, from 'hw:0':  Duration: N/A, start: 1357016490.047439, bitrate: 1536 kb/s    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/sInput #1, video4linux2,v4l2, from '/dev/video15':  Duration: N/A, start: 1903.142588, bitrate: 147456 kb/s    Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbcStream mapping:  Stream #1:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))  Stream #0:0 -> #0:1 (pcm_s16le (native) -> ac3 (native))Press [q] to stop, [?] for help[alsa @ 0x45320] ALSA buffer xrun.Output #0, avi, to 'test.avi':  Metadata:    ISFT            : Lavf57.83.100    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p(progressive), 640x480, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc    Metadata:      encoder         : Lavc57.107.100 mpeg4    Side data:      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s    Metadata:      encoder         : Lavc57.107.100 ac3frame=  146 fps= 14 q=27.3 Lsize=     516kB time=00:00:10.01 bitrate= 422.3kbits/s speed=0.992x    video:284kB audio:208kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.901391%[root@FriendlyARM /]# 


微信扫一扫

第七城市微信公众平台