[FFmpeg-user] "Packet header is not contained in global metadata" when segmenting and encoding x264

Werner Robitza werner.robitza at gmail.com
Wed Jul 23 12:36:12 CEST 2014


I have an x264-encoded MP4 file which I'd like to segment into MPEG-TS.

ffmpeg -y -i tmp/tmpPass2.mp4 -c:v libx264 -acodec copy -map 0 -f
segment -bsf h264_mp4toannexb -segment_time 5 -segment_format mpegts
./tsSegmentsDisplay/SRC04_Q1_%05d.ts

The original was encoded with:

ffmpeg -y -i ./srcVid/SRC04.avi -y -map 0:0 -c:v libx264 -pix_fmt
yuv420p -preset medium -profile:v high10 -level 4.0 -pass 1 -s
1920x1080 -r 24.0 -b:v 8500k -x264opts
merange=64:me=umh:b-pyramid=none:slices=1:b-adapt=0:bframes=2:scenecut=-1:threads=1:keyint=24
-map 0:1 -acodec libfdk_aac -profile:a aac_he_v2 -ac 2 -ab 128k
tmp/tmpPass1.mp4
ffmpeg -y -i ./srcVid/SRC04.avi -y -map 0:0 -c:v libx264 -pix_fmt
yuv420p -preset medium -profile:v high10 -level 4.0 -pass 2 -s
1920x1080 -r 24.0 -b:v 8500k -x264opts
merange=64:me=umh:b-pyramid=none:slices=1:b-adapt=0:bframes=2:scenecut=-1:threads=1:keyint=24
-map 0:1 -acodec libfdk_aac -profile:a aac_he_v2 -ac 2 -ab 128k
tmp/tmpPass2.mp4

Output from the segmenting command:

ffmpeg -y -i tmp/tmpPass2.mp4 -c:v libx264 -acodec copy -map 0 -f
segment -bsf h264_mp4toannexb -segment_time 5 -segment_format mpegts
./tsSegmentsDisplay/SRC04_Q1_%05d.ts
ffmpeg version N-64919-ga613257 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul 23 2014 00:35:22 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs
--enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 92.101 / 52. 92.101
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.101 / 55. 48.101
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.102 /  4. 11.102
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tmp/tmpPass2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.33.100
  Duration: 00:00:56.66, start: 0.161134, bitrate: 8528 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 8484 kb/s, 24 fps, 24 tbr, 12288 tbn, 48
tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000004db87a0] using SAR=1/1
[libx264 @ 0000000004db87a0] using cpu capabilities: MMX2 SSE2Fast
SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0000000004db87a0] profile High, level 4.0
[libx264 @ 0000000004db87a0] 264 - core 142 r2431 ac76440 -
H.264/MPEG-4 AVC codec - Copyleft 2003-2014 -
http://www.videolan.org/x264.html - options: cabac=1 ref=3
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0
deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
[mpegts @ 0000000006f42440] Using AVStream.codec.time_base as a
timebase hint to the muxer is deprecated. Set AVStream.time_base
instead.
    Last message repeated 1 times
[adts @ 0000000006f567e0] Using AVStream.codec.time_base as a timebase
hint to the muxer is deprecated. Set AVStream.time_base instead.
Output #0, segment, to './tsSegmentsDisplay/SRC04_Q1_%05d.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.48.101
    Stream #0:0(und): Video: h264 (libx264), yuv420p, 1920x1080 [SAR
1:1 DAR 16:9], q=-1--1, 24 fps, 24 tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc55.69.100 libx264
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz,
stereo, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0000000004db8340] Packet header is not contained in global
extradata, corrupted stream or invalid MP4/AVCC bitstream
Failed to open bitstream filter h264_mp4toannexb for stream 0 with
codec libx264: Invalid argument
[mpegts @ 0000000006f42440] H.264 bitstream malformed, no startcode
found, use the h264_mp4toannexb bitstream filter (-bsf
h264_mp4toannexb)
av_interleaved_write_frame(): Invalid argument
frame=   57 fps= 33 q=-1.0 Lsize=N/A time=00:00:02.69 bitrate=N/A dup=4 drop=0
video:201kB audio:21kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
[libx264 @ 0000000004db87a0] frame I:1     Avg QP:19.95  size:204698
[libx264 @ 0000000004db87a0] frame P:19    Avg QP:21.95  size: 42957
[libx264 @ 0000000004db87a0] frame B:37    Avg QP:26.12  size:  9696
[libx264 @ 0000000004db87a0] consecutive B-frames:  3.5%  7.0% 68.4% 21.1%
[libx264 @ 0000000004db87a0] mb I  I16..4: 36.5% 18.1% 45.4%
[libx264 @ 0000000004db87a0] mb P  I16..4:  7.0%  6.7%  1.7%  P16..4:
32.9% 13.2%  7.7%  0.0%  0.0%    skip:30.7%
[libx264 @ 0000000004db87a0] mb B  I16..4:  0.9%  1.2%  0.1%  B16..8:
38.4%  3.9%  0.5%  direct: 1.3%  skip:53.7%  L0:46.9% L1:44.3% BI:
8.9%
[libx264 @ 0000000004db87a0] 8x8 transform intra:40.2% inter:58.4%
[libx264 @ 0000000004db87a0] coded y,uvDC,uvAC intra: 33.5% 48.0%
23.3% inter: 11.4% 13.0% 1.2%
[libx264 @ 0000000004db87a0] i16 v,h,dc,p: 33% 29% 19% 19%
[libx264 @ 0000000004db87a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 19%
36%  1%  1%  1%  1%  1%  1%
[libx264 @ 0000000004db87a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 34%
11%  2%  2%  2%  3%  2%  3%
[libx264 @ 0000000004db87a0] i8c dc,h,v,p: 48% 23% 25%  4%
[libx264 @ 0000000004db87a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000004db87a0] ref P L0: 76.1% 14.4%  6.4%  3.1%
[libx264 @ 0000000004db87a0] ref B L0: 86.1% 11.9%  2.0%
[libx264 @ 0000000004db87a0] ref B L1: 86.7% 13.3%
[libx264 @ 0000000004db87a0] kb/s:4647.21
Conversion failed!

If I do a simple stream copy, everything works.
Any idea what the issue could be?


More information about the ffmpeg-user mailing list