是什么导致ffmpeg中出现“未指定像素格式”和“错误打开过滤器!”错误?

问题描述 投票:0回答:1

我正在编写一个mp4到HLS转码过程,该过程可以在小于7千兆字节的文件上运行(样本大小为100个视频)。尝试对大于7GB的任何内容进行转码时,它会崩溃。

命令:

ffmpeg 
  -i large_file.mp4 -y 
  -vf scale=w=1920:h=1080:force_original_aspect_ratio=decrease 
  -c:a aac 
  -ar 48000 
  -c:v h264 
  -profile:v main 
  -crf 20 
  -sc_threshold 0 
  -g 48 
  -keyint_min 48 
  -hls_time 4 
  -hls_playlist_type vod 
  -b:v 5000k 
  -maxrate 5350k 
  -bufsize 7500k 
  -b:a 192k 
  -hls_segment_filename /1080p_%03d.ts 
  -threads 0 
  /tmp/output-ef42dc65-1d3d-4682-b32b-68d7c712fb9c-raw-test/1080p.m3u8

错误:

ffmpeg version 3.2.12-1\x7edeb9u1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x555888d821c0] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720, 3856 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'large_file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.26.101
  Duration: 05:56:12.51, start: 0.000000, bitrate: 4061 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 3856 kb/s, 29.99 fps, 30 tbr, 100k tbn, 200k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 194 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[buffer @ 0x555888d88180] Unable to parse option value "-1" as pixel format
    Last message repeated 1 times
[buffer @ 0x555888d88180] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0x555888d81e40] Error applying options to the filter.
Error opening filters!

错误说试图增加analyzedurationprobesize,我设置为最大值(根据this帖子的答案),但这似乎并没有改变行为。我还怀疑该文件已损坏,但事实是所有大于7GB的文件都失败了,这使得它更难以建议与mp4大小无关的内容。

ffmpeg mp4 hls
1个回答
0
投票

结果证明comment by Gyan是正确的。我们正在使用docker进行部署(转码器是node.js,利用fluent-ffmpeg),因此升级并不像您想象的那样简单,因为我们需要在同一图像中进行多个构建(也称为多阶段构建) 。

我们遇到的问题:

  • ffmpeg image by jrottenberg不断生产error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or director。有一个issue开放,但没有提供解决方案,我也不能自己找到一个。
  • 我们发现了ffmpeg 4.1 image by alfg,但可执行文件放在opt/ffmpeg/bin而不是我们预期的位置,/usr/local/bin

鉴于此,这就是我们的Dockerfile的样子。工人正在吹嘘大文件。

FROM alfg/ffmpeg AS ffmpeg # stored at /opt/ffmpeg/bin/ffmpeg
FROM node:10.10.0-alpine AS build
RUN npm install --global [email protected]
WORKDIR /app
# need these for native libraries like bcrypt
RUN apk update && apk add python g++ make && rm -rf /var/cache/apk/*
COPY . ./
RUN yarn install --pure-lockfile

FROM node:10.10.0-alpine
COPY --from=build /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/
COPY --from=ffmpeg / /
COPY --from=build /app /

# add ffmpeg's location to path
ENV PATH="/opt/ffmpeg/bin/:${PATH}"

CMD [ "yarn", "start" ]
© www.soinside.com 2019 - 2024. All rights reserved.