我在使用编码选项将“mp42”文件编码为 mp4 (H264) 时遇到问题:
-vcodec libx264 -bufsize 32M -b:v 2800k -maxrate 3800k -g 63 -vf "scale=1280:720" -acodec aac -ab 192k -ar 44100 -ac 2 -strict experimental -profile:v baseline -level 3.1 -pix_fmt yuv420p"
视频文件信息:
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2017-09-15T15:25:16.000000Z
Duration: 01:28:40.00, start: 0.000000, bitrate: 1479 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 2996 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
Metadata:
creation_time : 2017-09-15T15:25:16.000000Z
handler_name : Alias Data Handler
encoder : AVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
FFMPEG 编码输出粘贴如下。由于各种原因,我无法升级到手动安装较新的 ffmpeg,但我使用的是 Debian 软件包版本(Debian OS 9.1),其中的 ffmpeg 比较新。
大家知道这个问题与什么有关吗?它是否已在较新的 ffmpeg 版本中得到解决?
ffmpeg version 3.2.7-1~deb9u1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/usr/local/shellscripte/markly/download-robert_k.mp4-1506570833-1506568923/robert_k.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2017-09-15T15:25:16.000000Z
Duration: 01:28:40.00, start: 0.000000, bitrate: 3206 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 2996 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
Metadata:
creation_time : 2017-09-15T15:25:16.000000Z
handler_name : Alias Data Handler
encoder : AVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2017-09-15T15:25:16.000000Z
handler_name : Alias Data Handler
[libx264 @ 0x5620b118ec60] VBV buffer (32000) > level limit (14000)
[libx264 @ 0x5620b118ec60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x5620b118ec60] profile Constrained Baseline, level 3.1
[libx264 @ 0x5620b118ec60] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=22 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=63 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3800 vbv_bufsize=32000 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/usr/local/shellscripte/markly/output-robert_k.mp4-1506570833-1506568923/robert_k_720p.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf57.56.101
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--1, 2800 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
creation_time : 2017-09-15T15:25:16.000000Z
handler_name : Alias Data Handler
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 3800000/0/2800000 buffer size: 32000000 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2017-09-15T15:25:16.000000Z
handler_name : Alias Data Handler
encoder : Lavc57.64.101 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 124 fps=0.0 q=3.0 size= 205kB time=00:00:05.52 bitrate= 303.6kbits/s speed= 11x
frame= 237 fps=237 q=24.0 size= 2801kB time=00:00:09.93 bitrate=2308.9kbits/s speed=9.94x
frame= 356 fps=237 q=28.0 size= 4978kB time=00:00:14.74 bitrate=2765.9kbits/s speed=9.83x
......
......
......
frame=36564 fps=167 q=26.0 size= 534254kB time=00:24:23.13 bitrate=2991.3kbits/s speed=6.67x
[h264 @ 0x5620b0bcdf80] Reference 3 >= 3
[h264 @ 0x5620b0bcdf80] error while decoding MB 38 33, bytestream 3005
[h264 @ 0x5620b0bcdf80] concealing 971 DC, 971 AC, 971 MV errors in B frame
[h264 @ 0x5620b08a2200] Invalid nal size 930990328
[h264 @ 0x5620b08a2200] Error splitting the input into NAL units.
[h264 @ 0x5620b09490e0] Invalid nal size 1837326039
[h264 @ 0x5620b09490e0] Error splitting the input into NAL units.
[h264 @ 0x5620b0957020] Invalid nal size 187446698
[h264 @ 0x5620b0957020] Error splitting the input into NAL units.
[h264 @ 0x5620b0aecf80] Invalid nal size 145353988
[h264 @ 0x5620b0aecf80] Error splitting the input into NAL units.
[h264 @ 0x5620b0b08ae0] Invalid nal size -1036350434
[h264 @ 0x5620b0b08ae0] Error splitting the input into NAL units.
[h264 @ 0x5620b0dad3c0] Invalid nal size -1622171000
[h264 @ 0x5620b0dad3c0] Error splitting the input into NAL units.
[aac @ 0x5620b118fa20] Multiple frames in a packet.
[aac @ 0x5620b118fa20] channel element 2.13 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] channel element 3.12 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] Reserved bit set.
[aac @ 0x5620b118fa20] Prediction is not allowed in AAC-LC.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] Number of bands (14) exceeds limit (5).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] Reserved bit set.
[aac @ 0x5620b118fa20] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5620b118fa20] Inconsistent channel configuration.
[aac @ 0x5620b118fa20] get_buffer() failed
Error while decoding stream #0:1: Invalid argument
[aac @ 0x5620b118fa20] Reserved bit set.
[aac @ 0x5620b118fa20] Number of scalefactor bands in group (57) exceeds limit (49).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] Reserved bit set.
[aac @ 0x5620b118fa20] Prediction is not allowed in AAC-LC.
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5620b118fa20] Remapped id too large
[aac @ 0x5620b118fa20] is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x5620b118fa20] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
Error while decoding stream #0:1: Not yet implemented in FFmpeg, patches welcome
[aac @ 0x5620b118fa20] Number of bands (3) exceeds limit (2).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] channel element 3.8 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5620b118fa20] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5620b118fa20] Inconsistent channel configuration.
[aac @ 0x5620b118fa20] get_buffer() failed
Error while decoding stream #0:1: Invalid argument
[aac @ 0x5620b118fa20] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5620b118fa20] Remapped id too large
[aac @ 0x5620b118fa20] is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x5620b118fa20] If you want to help, upload a sample of this file to ftp: //upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
Error while decoding stream #0:1: Not yet implemented in FFmpeg, patches welcome
答案1
由于输出显示从 24 分钟开始出现解码错误,因此流中可能存在一些损坏。以前在流与不同的编解码器焊接在一起时就见过这种情况。
您可能能够通过指定输入的持续时间来限制解码时间来解码前 24 分钟。
ffmpeg -t 24:23.13 -i <input> -vcodec libx264 -bufsize 32M -b:v 2800k -maxrate 3800k -g 63 -vf "scale=1280:720" -acodec aac -ab 192k -ar 44100 -ac 2 -strict experimental -profile:v baseline -level 3.1 -pix_fmt yuv420p"
答案2
看起来像是回归无法解码某些 H.264 隔行扫描流
我下载了 20180223 夜间版本和错误中的示例文件。我看到了相同的 NAL 错误 :(