【问题标题】:ffmpeg pipe:0: could not find codec parametersffmpeg 管道:0:找不到编解码器参数
【发布时间】:2014-05-25 00:03:39
【问题描述】:

当我运行这个命令时,我得到一个错误。如果我在没有管道的情况下运行,它可以工作。

带管道

cat mymovie.m4v | ffmpeg -i pipe:0 -an -analyzeduration 1000000 -f image2 -vf 
"select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr 'public/files/thumb%04d.png'

无管道(工程)

ffmpeg -i mymovie.m4v -an -analyzeduration 2147483647 -probesize 2147483647 -f image2 -vf 
"select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr 'public/files/thumb%04d.png'

输出

ffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 10 2014 17:50:46 with Apple LLVM version 5.1 (clang-503.0.38) 
(based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2 
--enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree 
--enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang 
--host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame 
--enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis 
--enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libvo-aacenc --enable-libass --enable-ffplay --enable-libspeex 
--enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r 
--enable-libopenjpeg --extra-cflags='-

I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 '
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libavresample   1.  2.  0 /  1.  2.  0
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd87b80f000] stream 0, offset 0x2c: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd87b80f000] Could not find codec parameters for stream 0
(Video: h264 (avc1 / 0x31637661), 1280x720, 3310 kb/s): unspecified pixel format

考虑增加“analyzeduration”和“probesize”选项的值 pipe:0: 找不到编解码器参数

我已尝试设置 (link)

-analyzeduration100 -probesize 10000000 
-analyzeduration 2147483647 -probesize 2147483647

还是不行。

【问题讨论】:

    标签: ffmpeg


    【解决方案1】:

    MP4 容器不是管道的最佳选择。制作 MP4 文件的复用器可能会在文件末尾放置某些信息。此信息是正确解复用所必需的,但如果使用管道,则不会立即可用。但是,您有几个选择:

    不要使用管道

    我不知道你为什么首先需要使用管道。只需将该文件用作普通输入即可:

    ffmpeg -i input.mp4 ...
    

    不要使用 MP4

    如果您必须使用管道,请考虑使用其他容器,例如 .mkv.ts 作为输入。

    重新混合你的 MP4 然后管道

    如果您必须使用 MP4,那么一种方法是重新排列 moov 原子,使其位于文件的开头:

    ffmpeg -i input.mp4 -c copy -movflags +faststart output.mp4
    

    【讨论】:

    • 另一个选项是设置-frag_size 1048576
    • 确实,使用 WEBM 容器代替 MP4 解决了我项目中的问题。看起来这只是因为在 MP4 末尾写入了一些信息,而 ffmpeg 需要读取输入直到最后才能开始生成输出。这就是为什么一旦 MP4 足够大,调整与缓冲区大小相关的不同选项将无济于事。
    猜你喜欢
    • 2011-04-13
    • 2012-07-24
    • 2017-08-24
    • 2021-03-01
    • 2017-07-16
    • 2022-01-17
    • 1970-01-01
    • 2021-10-03
    • 2013-10-27
    相关资源
    最近更新 更多