FFMPEG / libx264帧大小上限? [英] Upper limit on FFMPEG/libx264 frame sizes?

查看:277
本文介绍了FFMPEG / libx264帧大小上限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FFMPEG对非常大帧(4096 x 4096)的视频进行转码。这是一个短视频 - 只有不到两分钟,但源视频文件是15.8GB。 (视频是一种旨在投影到天文馆穹顶上的动画。)



源文件是包含未压缩的Photo-JPEG图像(带音频)的Quicktime MOV。当我告诉FFMPEG将我的MOV文件转码为MP4文件时,它只是说:


打开编码器输出流#0时出错: 0 - 可能不正确的参数,如bit_rate,速率,宽度或高度


不是很有帮助,但是,我已经验证了的参数是正确的和/或默认值。实际上,如果我将请求的输出大小更改为2048x2048,那么一切都可以正常运行。 这就是为什么我怀疑编码器中有一个上限。



我是kerflummoxed。任何导致成功转码的建议将不胜感激。 (此时我也愿意考虑替代FFMPEG。)



事实



我从脚本运行FFMPEG:

  set srcFile =%1 
set dstFile =%srcFile: .mov = .mp4%

ffmpeg -i%srcFile%-movflags faststart -q:a 0 -q:v 0 -pix_fmt yuv420p -sws_flags gauss -s 4096x4096%dstFile%

输出

  ffmpeg版本N-50911-g9efcfbe版权所有(c)2000-2013 FFmpeg开发者
建于2013年3月13日21:26:48与gcc 4.7.2(GCC)
配置:--enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable -libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --ena
ble-libopus --enable-librtmp --ena ble-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable -libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0。 17.102
libpostproc 52. 2.100 / 52. 2.100
输入#0,mov,mp4,m4a,3gp,3g2,mj2,来自'also-sprach-zarathustra-4k.mov':
元数据:
major_brand:qt
minor_version:537199360
compatible_brands:qt
creation_time:2013-01-11 23:41:30
时间:00:01:40.57 ,开始:0.000000,比特率:1357694 kb / s
流#0:0(eng):音频:pcm_s16be(twos / 0x736F7774),44100 Hz,ste reo,s16,1411 kb / s
元数据:
creation_time:2013-01-11 23:41:30
handler_name:Apple Alias数据处理程序
流#0:1( eng):Video:mjpeg(jpeg / 0x6765706A),yuvj420p,4096x4096 [SAR 1:1 DAR 1:1],1356281 kb / s,30 fps,30
tbr,3k tbn,3k tbc
元数据:
creation_time:2013-01-11 23:41:30
handler_name:Apple Alias Data Handler
文件'also-sprach-zarathustra-4k.mp4'已经存在。覆盖? [y / N] y
使用SAR = 1/1
[libx264 @ 003b9c80]帧MB大小(256x256)>级别限制(36864)
[libx264 @ 003b9c80] DPB大小(4帧,262144 mbs)>级别限制(2帧,184320 mbs)
[libx264 @ 003b9c80]使用cpu功能:MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI1 BMI2
x264 [错误]:malloc大小17305600失败
输出#0,mp4,到'also-sprach-zarathustra-4k.mp4':
元数据:
major_brand:qt
minor_version:537199360
compatible_brands:qt
流#0:0(eng):视频:h264,yuv420p,4096x4096 [SAR 1:1 DAR 1:1],q = 1--1,90k tbn,30 tbc
元数据:
creation_time:2013-01-11 23:41:30
handler_name:Apple Alias数据处理程序
流#0:1(eng):音频:无,44100 Hz,立体声,s16,128 kb / s
元数据:
创建时间:2013-01-11 23:41:30
处理程序名称:Apple Alias数据处理程序
流映射:
流#0:1 - > #0:0(mjpeg - > libx264)
流#0:0 - > #0:1(pcm_s16be - > libvo_aacenc)
打开输出流#0的编码器时出错0:可能是不正确的参数,如bit_rate,rate,width或height
PS:是的,对于那些在家玩的人来说,这是2001年太空漫游的主题。您可以在这里查看1K的YouTube版本: 2001 - Fulldome Space Odyssey 是的,在一个具有良好音响系统的天文馆,绝对是EPIC。

解决方案

我认为你实际上处于x264编解码器复杂程度的限制之中。



http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC



由于该术语在标准中使用, level是指定的一组约束条件,表示一个配置文件所需的解码器性能。例如,配置文件中的支持级别指定解码器可能使用的最大图像分辨率,帧速率和比特率。符合给定级别的解码器必须能够解码为该级别和所有较低级别编码的所有比特流。



最高级别(5.2)的最大分辨率为4096×2,304。



我将研究使用专门为这些较大格式的4K / Ultra-HD分辨率设计的HEVC。



http://en.wikipedia.org/维基/ HEVC



HEVC的最大分辨率目前为8,192x4,320


I'm trying to use FFMPEG to transcode a video with very large frames (4096 x 4096). It's a short video - just under two minutes, but the source video file is 15.8GB. (The video is an animation designed to be projected onto planetarium domes.)

The source file is a Quicktime MOV containing uncompressed Photo-JPEG images (with audio, too). When I tell FFMPEG to transcode my MOV file into an MP4 file, it simply says:

Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Not very helpful, but yes, I've verified that all of the parameters are correct and/or defaults. In fact, if I change the requested output size to 2048x2048, then everything works just fine. That's why I suspect that there's an upper bound in the encoder.

I am kerflummoxed. Any suggestions that result in a successful transcode will be greatly appreciated. (At this point I am also willing to consider alternatives to FFMPEG.)

The Facts

I run FFMPEG from a script:

set srcFile=%1
set dstFile=%srcFile:.mov=.mp4%

ffmpeg -i %srcFile% -movflags faststart -q:a 0 -q:v 0 -pix_fmt yuv420p -sws_flags gauss -s 4096x4096 %dstFile%

The Output

    ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
    built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --ena
ble-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 19.100 / 52. 19.100
  libavcodec     55.  0.100 / 55.  0.100
  libavformat    55.  0.100 / 55.  0.100
  libavdevice    54.  4.100 / 54.  4.100
  libavfilter     3. 45.103 /  3. 45.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'also-sprach-zarathustra-4k.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2013-01-11 23:41:30
  Duration: 00:01:40.57, start: 0.000000, bitrate: 1357694 kb/s
    Stream #0:0(eng): Audio: pcm_s16be (twos / 0x736F7774), 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      creation_time   : 2013-01-11 23:41:30
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj420p, 4096x4096 [SAR 1:1 DAR 1:1], 1356281 kb/s, 30 fps, 30
tbr, 3k tbn, 3k tbc
    Metadata:
      creation_time   : 2013-01-11 23:41:30
      handler_name    : Apple Alias Data Handler
File 'also-sprach-zarathustra-4k.mp4' already exists. Overwrite ? [y/N] y
using SAR=1/1
[libx264 @ 003b9c80] frame MB size (256x256) > level limit (36864)
[libx264 @ 003b9c80] DPB size (4 frames, 262144 mbs) > level limit (2 frames, 184320 mbs)
[libx264 @ 003b9c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI1 BMI2
x264 [error]: malloc of size 17305600 failed
Output #0, mp4, to 'also-sprach-zarathustra-4k.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    Stream #0:0(eng): Video: h264, yuv420p, 4096x4096 [SAR 1:1 DAR 1:1], q=-1--1, 90k tbn, 30 tbc
    Metadata:
      creation_time   : 2013-01-11 23:41:30
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: none, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2013-01-11 23:41:30
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> libx264)
  Stream #0:0 -> #0:1 (pcm_s16be -> libvo_aacenc)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

PS: Yes, for those playing at home, it is the theme to 2001 - A Space Odyssey. You can see a 1K YouTube version here: 2001 - A Fulldome Space Odyssey And yes, in a planetarium with a good sound system, it is absolutely EPIC.

解决方案

I think you're actually running into the limitation of of x264's codec complexity levels.

Brief description of the levels from http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC

As the term is used in the standard, a "level" is a specified set of constraints that indicate a degree of required decoder performance for a profile. For example, a level of support within a profile specifies the maximum picture resolution, frame rate, and bit rate that a decoder may use. A decoder that conforms to a given level must be able to decode all bitstreams encoded for that level and all lower levels.

The max resolution for the highest level (5.2) is 4,096×2,304.

I would look into using HEVC which is specifically designed for these larger format 4K / Ultra-HD resolutions.

http://en.wikipedia.org/wiki/HEVC

Max Resolution for HEVC is currently 8,192x4,320

这篇关于FFMPEG / libx264帧大小上限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆