FFmpeg:连接两个导致静态输出的视频文件

时间:2015-10-14 22:31:17

标签: video ffmpeg concat

我有两个.avi视频文件,我试图连接在一起。

我有一个files.txt

file './1_tmp.avi'
file './2_tmp.avi'

1_tmp.avi的FFprobe给了我:

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.8.5 (Gentoo 4.8.5 p1.3, pie-0.6.2)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags=' ' --disable-static --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --disable-outdev=sdl --enable-nonfree --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-gpl --enable-hardcoded-tables --enable-iconv --disable-lzma --enable-network --disable-openssl --enable-postproc --disable-libsmbclient --disable-ffplay --disable-vaapi --disable-vdpau --enable-xlib --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --enable-zlib --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --disable-opengl --disable-libv4l2 --disable-libpulse --disable-libopencore-amrwb --disable-libopencore-amrnb --enable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --disable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --disable-libvorbis --enable-libvpx --disable-libzvbi --disable-libbs2b --disable-libflite --disable-frei0r --disable-libfribidi --disable-fontconfig --disable-ladspa --disable-libass --disable-libfreetype --disable-libsoxr --enable-pthreads --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --disable-libaacplus --disable-libfaac --disable-libtheora --disable-libtwolame --disable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --disable-libxvid --enable-x11grab --disable-amd3dnow --disable-amd3dnowext --disable-fma4 --disable-xop --cpu=core-avx-i
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, avi, from '1_tmp.avi':
  Metadata:
    encoder         : Lavf56.36.100
  Duration: 00:00:19.00, start: 0.000000, bitrate: 179869 kb/s
    Stream #0:0: Video: huffyuv (HFYU / 0x55594648), bgr0, 1024x768, 180390 kb/s, 18 fps, 18 tbr, 18 tbn, 18 tbc

和2_tmp.avi:

ffprobe version 2.7.2 Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.8.5 (Gentoo 4.8.5 p1.3, pie-0.6.2)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags=' ' --disable-static --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --disable-outdev=sdl --enable-nonfree --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-gpl --enable-hardcoded-tables --enable-iconv --disable-lzma --enable-network --disable-openssl --enable-postproc --disable-libsmbclient --disable-ffplay --disable-vaapi --disable-vdpau --enable-xlib --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --enable-zlib --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --disable-opengl --disable-libv4l2 --disable-libpulse --disable-libopencore-amrwb --disable-libopencore-amrnb --enable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --disable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --disable-libvorbis --enable-libvpx --disable-libzvbi --disable-libbs2b --disable-libflite --disable-frei0r --disable-libfribidi --disable-fontconfig --disable-ladspa --disable-libass --disable-libfreetype --disable-libsoxr --enable-pthreads --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --disable-libaacplus --disable-libfaac --disable-libtheora --disable-libtwolame --disable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --disable-libxvid --enable-x11grab --disable-amd3dnow --disable-amd3dnowext --disable-fma4 --disable-xop --cpu=core-avx-i
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, avi, from '2_tmp.avi':
  Metadata:
    encoder         : Lavf56.36.100
  Duration: 00:00:56.00, start: 0.000000, bitrate: 160560 kb/s
    Stream #0:0: Video: huffyuv (HFYU / 0x55594648), bgr0, 1024x768, 160714 kb/s, 18 fps, 18 tbr, 18 tbn, 18 tbc

只有视频流,它们看起来是相同的编解码器/ fps

我正在使用此命令连接它们:

ffmpeg -f concat -i files.txt -c:v copy -y output.avi

我没有从终端获得任何输出,它输出一个文件。

文件打开,1_tmp.avi中的内容以相同的质量播放,但是当它到达视频中2_tmp.avi应该是的点时,它一直是像素化的静态(见下图)

static screen for second file after concatentation - mama **did not** say there would be days like this.

如果我使用如下命令:

ffmpeg -i 1_tmp.avi -i 2_tmp.avi -filter_complex "[0:0] [1:0] concat=n=2:v=1 [v]" -map "[v]" output.avi

我确实得到了两个合并在一起的视频的完整输出,但它被放到mpeg编解码器中,质量损失明显突出。

1 个答案:

答案 0 :(得分:1)

因此,似乎在串联中复制编解码器不起作用。

ffmpeg -f concat ...命令指定编解码器会返回相同的问题输出。

但是,以下命令有效:

ffmpeg -i 1_tmp.avi -i 2_tmp.avi -filter_complex "[0:0] [1:0] concat=n=2:v=1 [v]" -map -vcodec huffyuv "[v]" output.avi