Invalid NAL unit size for MP4 created from NALU with 3-byte start code (0x000001)

0

I have a mp4 muxer that works fine when the H264 NALU has the 4-byte start code (0x00000001). I am adapting it to support 3-byte start code (0x000001) but I am stuck with a bug that I am not able to identify. The MP4 generated open in VLC and MediaPlayer but no video is displayed. In VLC statistics shows that it is decoding blocks but stays with 0 frames displayed.

I then ran a error analyzer using ffmpeg (ffmpeg -v error -i myvideo.mp4 -f null - 2>error.log that shows me the following output:

[h264 @ 0x7fa3b5003200] Invalid NAL unit size (158559 > 158558).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9338 > 9337).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (6582 > 6581).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (8300 > 8299).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9336 > 9335).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9422 > 9421).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (10448 > 10447).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9208 > 9207).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (8776 > 8775).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (11376 > 11375).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (158311 > 158310).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9164 > 9163).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (7994 > 7993).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9974 > 9973).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9282 > 9281).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.
[h264 @ 0x7fa3b5003200] Invalid NAL unit size (9656 > 9655).
[h264 @ 0x7fa3b5003200] Error splitting the input into NAL units.

I am trying to find why it is complaining about 1 byte difference in all mdat boxes. Also, the smaller values (e.g: 158558) are 12 bytes lower than the size written inside the mdat header.

Anyone could help indicate why that error is happening? The same code is working fine to create MP4 with 4-byte NALU start code.

UPDATE: I ran ffprobe and it provides a few more details, more specifically saying that couldn't find the "codec parameters":

$ ffprobe -analyzeduration 2147483647 -probesize 2147483647 -i myvideo.mp4 
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147087 > 147086).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8104 > 8103).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9752 > 9751).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12058 > 12057).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9026 > 9025).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12032 > 12031).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12566 > 12565).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7906 > 7905).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9758 > 9757).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12840 > 12839).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (146771 > 146770).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7708 > 7707).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9524 > 9523).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12230 > 12229).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9080 > 9079).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12164 > 12163).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12650 > 12649).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7916 > 7915).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9736 > 9735).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (13086 > 13085).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147143 > 147142).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8218 > 8217).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9908 > 9907).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12450 > 12449).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7806 > 7805).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9598 > 9597).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12692 > 12691).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9782 > 9781).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12930 > 12929).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12750 > 12749).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (146911 > 146910).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8182 > 8181).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9494 > 9493).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12268 > 12267).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8898 > 8897).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11946 > 11945).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12622 > 12621).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8108 > 8107).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9754 > 9753).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12110 > 12109).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147067 > 147066).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7726 > 7725).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9424 > 9423).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12078 > 12077).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8976 > 8975).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11686 > 11685).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11940 > 11939).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9274 > 9273).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11950 > 11949).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11702 > 11701).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147021 > 147020).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7686 > 7685).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9572 > 9571).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11810 > 11809).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11584 > 11583).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9116 > 9115).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11986 > 11985).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11390 > 11389).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9008 > 9007).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11768 > 11767).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147347 > 147346).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7618 > 7617).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9266 > 9265).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12046 > 12045).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11562 > 11561).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8898 > 8897).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11672 > 11671).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11458 > 11457).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8850 > 8849).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11452 > 11451).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147213 > 147212).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7540 > 7539).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9610 > 9609).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12302 > 12301).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9154 > 9153).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11868 > 11867).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12054 > 12053).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7508 > 7507).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9136 > 9135).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11812 > 11811).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147089 > 147088).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7800 > 7799).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9482 > 9481).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12244 > 12243).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9198 > 9197).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11962 > 11961).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12386 > 12385).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7618 > 7617).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (8996 > 8995).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11800 > 11799).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147135 > 147134).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7934 > 7933).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9742 > 9741).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12398 > 12397).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7540 > 7539).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9130 > 9129).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12482 > 12481).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12002 > 12001).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11710 > 11709).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11886 > 11885).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147303 > 147302).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7620 > 7619).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9316 > 9315).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12138 > 12137).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9056 > 9055).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11968 > 11967).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11942 > 11941).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9072 > 9071).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11546 > 11545).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (11368 > 11367).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (147363 > 147362).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (7578 > 7577).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9466 > 9465).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (12230 > 12229).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[h264 @ 0x7fa85f800e00] Invalid NAL unit size (9248 > 9247).
[h264 @ 0x7fa85f800e00] Error splitting the input into NAL units.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa85f000000] decoding for stream 0 failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa85f000000] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x960, 1717 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myvideo.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:00:13.22, start: 0.000000, bitrate: 1726 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x960, 1717 kb/s, 8.70 fps, 9.25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandle
ffmpeg
size
mp4
h.264
nalu
asked on Stack Overflow Sep 3, 2020 by rsc • edited Sep 3, 2020 by rsc

1 Answer

0

The "Invalid NAL unit size" was referring to the Moof->Traf->Trun "sample size" with a value different than the actual mdat payload size (mdat payload = mdat box without the first 8 bytes which are the length and the 'mdat' name).

That was happening due to my muxer receiving the H264 chunk and using that chunk size as the "sample size" instead of calculating the actual mdat payload size. That bug only got visible when the H264 chunks received by my muxer didn't have a 4-byte NALU start code (since I am using 4 bytes for each NALU length size).

answered on Stack Overflow Sep 9, 2020 by rsc

User contributions licensed under CC BY-SA 3.0