【问题标题】:What is causing "unspecified pixel format" and "Error opening filters!" error in ffmpeg?是什么导致“未指定的像素格式”和“打开过滤器错误!” ffmpeg中的错误?
【发布时间】:2019-07-10 22:14:44
【问题描述】:

我正在编写一个 mp4 到 HLS 转码过程,该过程在小于 7 GB 的文件(样本大小为 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 升级到 4.1 或更新版本 (git) 并检查。

标签: ffmpeg mp4 http-live-streaming


【解决方案1】:

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

我们遇到的问题:

  • 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 如下所示。 Worker 正在处理大文件。

FROM alfg/ffmpeg AS ffmpeg # stored at /opt/ffmpeg/bin/ffmpeg
FROM node:10.10.0-alpine AS build
RUN npm install --global yarn@1.10.1
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" ]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-25
    • 2021-01-12
    • 1970-01-01
    • 2019-01-28
    相关资源
    最近更新 更多