FFmpeg 'scale' filter not present, cannot convert pixel formats.

/***************************************************************************
 *  FFmpeg  'scale' filter not present, cannot convert pixel formats. 
 * 说明:
 *     使用FFmpeg的过程中遇到这个问题,记录一下解决办法。
 *
 *                                      2017-2-6 深圳 南山平山村 曾剑锋
 **************************************************************************/

一、参考文档:
    1. 支持各类音频格式的ffmpeg静态编译
        http://andremouche.github.io/ffmpeg/ffmpeg-audio.html
    2. How do I use ffmpeg to take pictures with my web camera?
        http://askubuntu.com/questions/102755/how-do-i-use-ffmpeg-to-take-pictures-with-my-web-camera

二、出错现象:
    # ffmpeg -y  -r 25 -i /dev/video1 out.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/zengjf/tinyfs/buildroot-2016.11.1/output/host/usr/bin/arm-none-linux-gnueabi- --sysroot=/home/zengjf/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/zengjf/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 --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 --disable-gpl --disable-nonfree --enable-ffmpeg --disable-ffplay --disable-ffserver --disable-avresample --disable-ffprobe --disable-postproc --disable-swscale --enable-indevs --enable-outdevs --enable-pthreads --enable-zlib --enable-bzlib --disable-libfdk-aac --disable-gnutls --enable-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 --disable-libfreetype --disable-fontconfig --disable-libx264 --disable-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
      libswresample   2.  3.100 /  2.  3.100
    Input #0, video4linux2,v4l2, from '/dev/video1':
      Duration: N/A, start: 1111.503970, bitrate: 147456 kb/s
        Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
    'scale' filter not present, cannot convert pixel formats.
    Error opening filters!
    # 

三、解决方法:
    编译时添加scale的支持:
        --enable-swscale --enable-swscale-alpha --enable-filter=scale 

四、获取一张图片:
    # ffmpeg -f video4linux2 -i /dev/v4l/by-id/usb-Guillemot_Corporation_USB_Camera-
    video-index0  -vframes 1 test.jpeg
    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/zengjf/tinyfs/buildroot-2016.11.1/output/host/usr/bin/arm-none-linux-gnueabi- --sysroot=/home/zengjf/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/zengjf/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 --disable-gpl --disable-nonfree --enable-ffmpeg --enable-ffplay --enable-ffserver --disable-avresample --disable-ffprobe --disable-postproc --enable-swscale --enable-indevs --enable-outdevs --enable-pthreads --enable-zlib --enable-bzlib --disable-libfdk-aac --disable-gnutls --enable-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 --disable-libx264 --disable-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
    Input #0, video4linux2,v4l2, from '/dev/v4l/by-id/usb-Guillemot_Corporation_USB_Camera-video-index0':
      Duration: N/A, start: 59.897642, bitrate: 147456 kb/s
        Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
    [swscaler @ 0x600c0] deprecated pixel format used, make sure you did set range correctly
    Output #0, image2, to 'test.jpeg':
      Metadata:
        encoder         : Lavf57.56.100
        Stream #0:0: Video: mjpeg, yuvj422p(pc), 640x480, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
        Metadata:
          encoder         : Lavc57.64.100 mjpeg
        Side data:
          cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
    Press [q] to stop, [?] for help
    frame=    1 fps=0.0 q=4.4 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.295x    
    video:25kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    # 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值