ffmpeg video filter command line examples

1. boxblur

 

ffmpeg -f mpegts -i ../../film.ts -c:a libfaac -ar 48000 -ac 1 -c:v libx264 -s 720x480 -aspect 4:3 -vf boxblur=2:1 -f mpegts fm720.ts

 

2. crop

ffmpeg -f mpegts -i ../../film.ts -c:a libfaac -ar 48000 -ac 1 -c:v libx264 -s 720x480 -aspect 4:3 -vf crop=300:100:1:3 -f mpegts fm720.ts

 

 

 

 

appendix:

 

#!/bin/bash

# ./configure --enable-gpl --enable-postproc --enable-swscale
# --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libfaac
# --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libtheora
# --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree
#
#
# --enable-encoder=mp3 \
# --enable-muxer=aac \

ASS_INC=/usr/local/ass/include
X264_INC=/usr/local/x264-1.29/include
FAAC_INC=/usr/local/faac-1.28/include
AMRNB_INC=/usr/local/opencore/include
FDKAAC_INC=/usr/local/fdk-aac/include
VOAAC_INC=/usr/local/vo-aac/include
AMRWB_INC=/usr/local/vo-amrwb/include
OGG_INC=/usr/local/ogg/include
VORBIS_INC=/usr/local/vorbis/include
OPENCV_INC=/usr/local/opencv/include
BLURAY_INC=/usr/local/bluray/include
FREETYPE_INC=/usr/local/freetype/include
OPENJPEG_INC=/usr/local/openjpeg/include
RTMP_INC=/usr/local/rtmp/include

ASS_LIB=/usr/local/ass/lib
X264_LIB=/usr/local/x264-1.29/lib
FAAC_LIB=/usr/local/faac-1.28/lib
AMRNB_LIB=/usr/local/opencore/lib
FDKAAC_LIB=/usr/local/fdk-aac/lib
VOAAC_LIB=/usr/local/vo-aac/lib
AMRWB_LIB=/usr/local/vo-amrwb/lib
OGG_LIB=/usr/local/ogg/lib
VORBIS_LIB=/usr/local/vorbis/lib
OPENCV_LIB=/usr/local/opencv/lib
BLURAY_LIB=/usr/local/bluray/lib
FREETYPE_LIB=/usr/local/freetype/lib
OPENJPEG_LIB=/usr/local/openjpeg/lib
RTMP_LIB=/usr/local/rtmp/lib

LOCAL_CFLAGS="-I${ASS_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${X264_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${FAAC_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${AMRNB_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${FDKAAC_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${VOAAC_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${AMRWB_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${OGG_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${VORBIS_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${OPENCV_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${BLURAY_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${FREETYPE_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${OPENJPEG_INC}"
LOCAL_CFLAGS="${LOCAL_CFLAGS} -I${RTMP_INC}"

LOCAL_LD_FLAGS="-L${ASS_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${X264_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${FAAC_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${AMRNB_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${FDKAAC_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${VOAAC_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${AMRWB_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${OGG_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${VORBIS_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${OPENCV_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${BLURAY_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${FREETYPE_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${OPENJPEG_LIB}"
LOCAL_LD_FLAGS="${LOCAL_LD_FLAGS} -L${RTMP_LIB}"

#LOCAL_EXTRA_CFLAGS="-I/usr/local/x264-1.29/include -I/usr/local/faac-1.28/include -I/usr/local/opencore/include -I/usr/local/rtmp/include"
#LOCAL_LD_FLAGS="-L/usr/local/x264-1.29/lib -L/usr/local/faac-1.28/lib -L/usr/local/opencore/lib -L/usr/local/rtmp/lib"

PKG_CONFIG_PATH="${OPENCV_LIB}/pkgconfig:${RTMP_LIB}/pkgconfig"
echo "pkg_config_path=$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH

cd ffmpeg-1.1.2.debug

#       --enable-libopenjpeg \
#       --enable-libfdk-aac \

./configure --prefix=/usr/local/ffmpeg-1.1.2 \
 --enable-version3 \
 --enable-pic \
 --enable-gpl \
        --enable-pthreads \
 --enable-avfilter \
 --enable-shared \
 --disable-encoders \
 --disable-decoders \
 --enable-libass \
 --enable-libbluray \
 --enable-libfreetype \
 --enable-libx264 \
 --enable-librtmp \
 --enable-libfaac \
        --enable-libopencv \
        --enable-libopencore-amrnb \
        --enable-libopencore-amrwb \
        --enable-libvo-aacenc \
        --enable-libvo-amrwbenc \
        --enable-libvorbis \

 --enable-decoder=hevc \
 --enable-encoder=rawvideo \
 --enable-decoder=rawvideo \
 --enable-encoder=srt \
 --enable-decoder=srt \
 --enable-encoder=ass \
 --enable-decoder=ass \
 --enable-encoder=subrip \
 --enable-decoder=subrip \
 --enable-encoder=libx264 \
 --enable-decoder=h264 \
 --enable-encoder=h263 \
 --enable-decoder=h263 \
 --enable-encoder=libopencore_amrnb \
 --enable-decoder=libopencore_amrnb \
 --enable-decoder=libopencore_amrwb \
 --enable-encoder=libopenjpeg \
 --enable-decoder=libopenjpeg \
 --enable-decoder=libvorbis \
 --enable-decoder=mp3 \
 --enable-encoder=pcm_s16le \
 --enable-decoder=pcm_s16le \
 --enable-encoder=libfaac \
 --enable-encoder=libfdk_aac \
 --enable-encoder=libvo_aacenc \
 --enable-encoder=libvo_amrwbenc \
 --enable-encoder=libvorbis \
 --enable-decoder=aac \
 --enable-decoder=aac_latm \
 --disable-muxers \
 --enable-muxer=rawvideo \
 --enable-muxer=mpegts \
 --enable-muxer=h264 \
 --enable-muxer=f4v \
 --enable-muxer=flv \
 --enable-muxer=mov \
 --enable-muxer=mp4 \
 --enable-muxer=ogg \
 --enable-muxer=rtp \
 --enable-muxer=rtsp \
 --enable-muxer=tgp \
 --enable-muxer=tg2 \
 --enable-muxer=pcm_s16le \
 --enable-muxer=ass \
 --enable-muxer=srt \
 --disable-demuxers \
 --enable-demuxer=rawvideo \
 --enable-demuxer=h264 \
 --enable-demuxer=mpegts \
 --enable-demuxer=aac \
 --enable-demuxer=flv \
 --enable-demuxer=mov \
 --enable-demuxer=ogg \
 --enable-demuxer=pcm_s16le \
 --enable-demuxer=rtp \
 --enable-demuxer=rtsp \
 --enable-demuxer=sdp \
 --enable-demuxer=ass \
 --enable-demuxer=srt \
        --enable-filter=subtitles \
        --enable-filter=ass \
        --enable-filter=boxblur \
        --enable-filter=crop \
        --enable-filter=drawbox \
 --enable-debug \
        --enable-nonfree \
 --disable-postproc  \
 --disable-stripping \
 --disable-ffserver --disable-ffplay \
 --extra-cflags="$LOCAL_CFLAGS" \
 --extra-ldflags="$LOCAL_LD_FLAGS"


#            --disable-encoder=asv1 --disable-encoder=asv2 \
#            --disable-encoder=bmp --disable-encoder=dvvideo \
#            --disable-encoder=ffv1 --disable-encoder=ffvhuff \
#            --disable-encoder=flac --disable-encoder=zmbv \
#            --disable-encoder=h261 --disable-encoder=sonic_ls \
#            --disable-encoder=huffyuv --disable-encoder=jpegls \
#            --disable-encoder=ljpeg --disable-encoder=pam \
#            --disable-encoder=pbm --disable-encoder=pgm \
#            --disable-encoder=pgmyuv --disable-encoder=png \
#            --disable-encoder=ppm --disable-encoder=rv10 \
#            --disable-encoder=rv20 --disable-encoder=sgi \
#            --disable-encoder=snow --disable-encoder=svq1 \
#            --disable-encoder=targa --disable-encoder=xvid \
#            --disable-encoder=zlib --disable-encoder=zmbv \
#            --disable-encoder=sonic \
#            --disable-encoder=adpcm_adx --disable-encoder=adpcm_ct \
#            --disable-encoder=adpcm_ea --disable-encoder=adpcm_g726 \
#            --disable-encoder=adpcm_ima_dk3 --disable-encoder=adpcm_ima_dk4 \
#            --disable-encoder=adpcm_ima_qt --disable-encoder=adpcm_ima_smjpeg \
#            --disable-encoder=adpcm_ima_wav --disable-encoder=adpcm_ima_ws \
#            --disable-encoder=adpcm_ms --disable-encoder=adpcm_sbpro_2 \
#            --disable-encoder=adpcm_sbpro_3 --disable-encoder=adpcm_sbpro_4 \
#            --disable-demuxer=thp --disable-demuxer=tiertexseq \
#            --disable-muxer=aiff --disable-muxer=amr \
#            --disable-muxer=apc \
#            --disable-muxer=au --disable-muxer=avi \
#            --disable-muxer=avs --disable-muxer=bethsoftvid \
#            --disable-muxer=c93 --disable-muxer=daud \
#            --disable-muxer=dc1394 --disable-muxer=dsicin \
#            --disable-muxer=dts --disable-muxer=dv \
#            --disable-muxer=dv1394 --disable-muxer=dxa \
#            --disable-muxer=ea \
#            --disable-muxer=flac --disable-muxer=flic \
#            --disable-muxer=fourxm \
#            --disable-muxer=gxf --disable-muxer=idcin \
#            --disable-muxer=ingenient --disable-muxer=ipmovie \
#            --disable-muxer=mxf --disable-muxer=mtv \
#            --disable-muxer=ogg \
#            --disable-muxer=nut --disable-muxer=nsv \
#            --disable-parser=dca \
#            --disable-parser=vp6 --disable-parser=ppm \
#            --disable-parser=kmvc --disable-parser=loco
#
#--extra-cflags="-DONLY_H264_DECODE"

make clean
make -j4 || exit 1
make install || exit 1

cp ./config.h  /usr/local/ffmpeg-1.1.2/include/
cp ./libavformat/mpegts.h /usr/local/ffmpeg-1.1.2/include/libavformat/
cp ./libswscale/swscale_internal.h /usr/local/ffmpeg-1.1.2/include/libswscale/

echo "Compile and Install finished."

 

你可能感兴趣的:(ffmpeg video filter command line examples)