I.MX6 FFmpeg 录制视频
/************************************************************************* * I.MX6 FFmpeg 录制视频 * 说明: * 通过FFmpeg录制视频是很正常的事,测试一下。 * * 2017-2-10 深圳 南山平山村 曾剑锋 ************************************************************************/ 一、 参考文档: 1. FFmpeg 录制桌面、麦克风、摄像头 http://blog.csdn.net/candcplusplus/article/details/53955012 二、测试命令: ffmpeg -f video4linux2 -t 30 -i /dev/video1 -vcodec libx264 -f mp4 test1.mp4 三、视频录制信息: # ffmpeg -f video4linux2 -t 30 -i /dev/video1 -vcodec libx264 -f mp4 test1.mp4 ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8.3 (Sourcery CodeBench Lite 2014.05-29) 20140320 (prerelease) configuration: --enable-cross-compile --cross-prefix=/home/aplex/tinyfs/buildroot-2016.11.1/output/host/usr/bin/arm-none-linux-gnueabi- --sysroot=/home/aplex/tinyfs/buildroot-2016.11.1/output/host/usr/arm-buildroot-linux-gnueabi/sysroot --host-cc=/usr/bin/gcc --arch=arm --target-os=linux --disable-stripping --pkg-config=/home/aplex/tinyfs/buildroot-2016.11.1/output/host/usr/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --disable-x11grab --enable-network --disable-gray --enable-swscale-alpha --enable-filter=scale --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-memalign-hack --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-avisynth --disable-frei0r --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libcdio --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libnut --disable-libopenjpeg --disable-libschroedinger --disable-libvo-amrwbenc --disable-symver --disable-doc --enable-gpl --disable-nonfree --enable-ffmpeg --enable-ffplay --enable-ffserver --disable-avresample --disable-ffprobe --enable-postproc --enable-swscale --enable-indevs --enable-outdevs --enable-pthreads --enable-zlib --enable-bzlib --disable-libfdk-aac --disable-gnutls --disable-openssl --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-libopencv --disable-libopus --disable-libvpx --disable-libass --disable-libbluray --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --disable-libtheora --disable-libwavpack --enable-libfreetype --disable-fontconfig --enable-libx264 --enable-libx265 --disable-yasm --disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --enable-armv6 --disable-vfp --disable-neon --disable-altivec --enable-pic --cpu=cortex-a9 libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.100 / 57. 64.100 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Input #0, video4linux2,v4l2, from '/dev/video1': Duration: N/A, start: 1190.523607, bitrate: 147456 kb/s Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc File 'test1.mp4' already exists. Overwrite ? [y/N] y No pixel format specified, yuv422p for H.264 encoding chosen. Use -pix_fmt yuv420p for compatibility with outdated media players. [libx264 @ 0x4c450] using cpu capabilities: ARMv6 NEON [libx264 @ 0x4c450] profile High 4:2:2, level 3.0, 4:2:2 8-bit [libx264 @ 0x4c450] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'test1.mp4': Metadata: encoder : Lavf57.56.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv422p, 640x480, q=-1--1, 30 fps, 15360 tbn, 30 tbc Metadata: encoder : Lavc57.64.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help frame= 79 fps= 13 q=29.0 size= 121kB time=00:00:00.96 bitrate=1021.8kbits/frame= 84 fps= 13 q=29.0 size= 122kB time=00:00:01.13 bitrate= 884.9kbits/frame= 91 fps= 13 q=29.0 size= 123kB time=00:00:01.36 bitrate= 739.4kbits/frame= 99 fps= 13 q=29.0 size= 124kB time=00:00:01.63 bitrate= 621.4kbits/frame= 104 fps= 13 q=29.0 size= 124kB time=00:00:01.80 bitrate= 565.0kbits/frame= 262 fps= 30 q=29.0 size= 219kB time=00:00:07.06 bitrate= 254.1kbits/frame= 266 fps= 13 q=29.0 size= 219kB time=00:00:07.20 bitrate= 249.7kbits/frame= 278 fps= 13 q=29.0 size= 220kB time=00:00:07.60 bitrate= 237.2kbits/frame= 283 fps= 13 q=29.0 size= 220kB time=00:00:07.76 bitrate= 232.4kbits/frame= 288 fps= 13 q=29.0 size= 221kB time=00:00:07.93 bitrate= 227.8kbits/frame= 299 fps= 13 q=29.0 size= 246kB time=00:00:08.30 bitrate= 242.5kbits/frame= 308 fps= 13 q=29.0 size= 246kB time=00:00:08.60 bitrate= 234.6kbits/frame= 312 fps=9.6 q=-1.0 Lsize= 451kB time=00:00:10.30 bitrate= 358.4kbits/s dup=226 drop=0 speed=0.319x video:446kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.000611% [libx264 @ 0x4c450] frame I:4 Avg QP:25.07 size: 20970 [libx264 @ 0x4c450] frame P:79 Avg QP:18.96 size: 2767 [libx264 @ 0x4c450] frame B:229 Avg QP:27.88 size: 671 [libx264 @ 0x4c450] consecutive B-frames: 1.6% 1.3% 1.0% 96.2% [libx264 @ 0x4c450] mb I I16..4: 23.5% 52.4% 24.1% [libx264 @ 0x4c450] mb P I16..4: 1.9% 3.5% 0.7% P16..4: 17.1% 2.9% 2.5% 0.0% 0.0% skip:71.4% [libx264 @ 0x4c450] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 10.4% 0.6% 0.1% direct: 1.2% skip:87.5% L0:40.9% L1:56.1% BI: 3.1% [libx264 @ 0x4c450] 8x8 transform intra:55.4% inter:83.9% [libx264 @ 0x4c450] coded y,uvDC,uvAC intra: 48.3% 88.0% 59.2% inter: 2.4% 9.2% 2.3% [libx264 @ 0x4c450] i16 v,h,dc,p: 14% 20% 4% 62% [libx264 @ 0x4c450] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 21% 20% 6% 6% 7% 10% 6% 7% [libx264 @ 0x4c450] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 33% 16% 3% 5% 5% 11% 3% 4% [libx264 @ 0x4c450] i8c dc,h,v,p: 60% 13% 19% 8% [libx264 @ 0x4c450] Weighted P-Frames: Y:2.5% UV:1.3% [libx264 @ 0x4c450] ref P L0: 56.2% 11.0% 24.4% 7.7% 0.6% [libx264 @ 0x4c450] ref B L0: 75.6% 21.6% 2.8% [libx264 @ 0x4c450] ref B L1: 91.8% 8.2% [libx264 @ 0x4c450] kb/s:350.88 # ls test1.mp4 #