TransWikia.com

FFMPEG: Error splitting the input into NAL units / Timestamps are unset in a packet for stream 0 when changing from avi to mp4

Super User Asked by jiko on December 16, 2021

I am trying to change the container of a video acquired from an NVR using ffmpeg, but the output video is not playable by VLC or QuickTime. The output video stays still. In detail, using the following command:

ffmpeg -i input.avi -c:v copy output.mp4

I get the following error and warning messages:

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --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-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --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. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[h264 @ 0x7fc5aa810e00] missing picture in access unit with size 16
[h264 @ 0x7fc5aa810e00] No start code is found.
[h264 @ 0x7fc5aa810e00] Error splitting the input into NAL units.
[h264 @ 0x7fc5aa810e00] missing picture in access unit with size 16
[h264 @ 0x7fc5aa810e00] No start code is found.
[h264 @ 0x7fc5aa810e00] Error splitting the input into NAL units.
[h264 @ 0x7fc5aa810e00] missing picture in access unit with size 16
[h264 @ 0x7fc5aa810e00] No start code is found.
[h264 @ 0x7fc5aa810e00] Error splitting the input into NAL units.
[h264 @ 0x7fc5aa810e00] missing picture in access unit with size 16
...
    Last message repeated 13 times
Input #0, avi, from 'input.avi':
  Duration: 01:00:09.43, start: 0.000000, bitrate: 423 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuvj420p(pc, bt709, progressive), 1280x720, 418 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc

Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1280x720, q=2-31, 418 kb/s, 30 fps, 30 tbr, 1000k tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7fb18580a600] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[NULL @ 0x7fb185000600] missing picture in access unit with size 16
    Last message repeated 14 times
[NULL @ 0x7fb185000600] missing picture in access unit with size 8
[NULL @ 0x7fb185000600] missing picture in access unit with size 16
    Last message repeated 35943 times
[NULL @ 0x7fb185000600] missing picture in access unit with size 16= 431.7kbits/s speed=3.99e+03x
    Last message repeated 29061 times
frame=108284 fps=0.0 q=-1.0 Lsize=  183632kB time=01:00:09.39 bitrate= 416.8kbits/s speed=4.05e+03x
video:184216kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

The input video details using ffprobe are listed below:

{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_time_base": "33333/2000000",
            "codec_tag_string": "H264",
            "codec_tag": "0x34363248",
            "width": 1280,
            "height": 720,
            "coded_width": 1280,
            "coded_height": 720,
            "has_b_frames": 0,
            "pix_fmt": "yuvj420p",
            "level": 31,
            "color_range": "pc",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "r_frame_rate": "30/1",
            "avg_frame_rate": "1000000/33333",
            "time_base": "33333/1000000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 108284,
            "duration": "3609.430572",
            "bit_rate": "418103",
            "bits_per_raw_sample": "8",
            "nb_frames": "108284",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "format": {
        "filename": "input.avi",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "avi",
        "format_long_name": "AVI (Audio Video Interleaved)",
        "start_time": "0.000000",
        "duration": "3609.430572",
        "size": "191260108",
        "bit_rate": "423911",
        "probe_score": 100
    }
}

Output video details

{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_time_base": "33333/2000000",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 1280,
            "height": 720,
            "coded_width": 1280,
            "coded_height": 720,
            "has_b_frames": 0,
            "pix_fmt": "yuvj420p",
            "level": 31,
            "color_range": "pc",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "chroma_location": "left",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "r_frame_rate": "1000000/33333",
            "avg_frame_rate": "1000000/33333",
            "time_base": "1/1000000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 3609430572,
            "duration": "3609.430572",
            "bit_rate": "415792",
            "bits_per_raw_sample": "8",
            "nb_frames": "108284",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            },
            "tags": {
                "language": "und",
                "handler_name": "VideoHandler"
            }
        }
    ],
    "format": {
        "filename": "cam4_03-14-20.mp4",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "3609.431000",
        "size": "188039397",
        "bit_rate": "416773",
        "probe_score": 100,
        "tags": {
            "major_brand": "isom",
            "minor_version": "512",
            "compatible_brands": "isomiso2avc1mp41",
            "encoder": "Lavf58.29.100"
        }
    }
}

Any suggestions on how to change the container without re-encoding?

One Answer

You use the option -c:v. It is usually used for re-encoding video.
Use just like that:

ffmpeg -i input.avi output.mp4

Answered by Paul_ghost on December 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP