2

mediainfo on the file gives the following output -

General
Complete name                            : 0x5C3C6393.raw
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 91.7 MiB

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=15
Width                                    : 800 pixels
Height                                   : 600 pixels
Display aspect ratio                     : 4:3
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

I have tried ffmpeg -f rawvideo -pixel_format yuv420p -video_size 800x600 -framerate 15 -i 0x5C3C6393.raw test.avi, but it doesn't work. Output of this command -

ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[rawvideo @ 0x819e00] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from '0x5C3C6393.raw':
  Duration: 00:00:08.93, start: 0.000000, bitrate: 86129 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 800x600, 86400 kb/s, 15 tbr, 15 tbn, 15 tbc
Output #0, avi, to 'test.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 800x600, q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc
    Metadata:
      encoder         : Lavc56.60.100 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
[rawvideo @ 0x8236c0] Invalid buffer size, packet size 417540 < expected frame_size 720000
Error while decoding stream #0:0: Invalid argument
frame=  133 fps=0.0 q=24.8 Lsize=   31118kB time=00:00:08.86 bitrate=28750.0kbits/s
video:31109kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.028070%

Output of ffmpeg -i 0x5C3C6393.raw -c copy output.mp4 -

ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[image2 @ 0xdf4de0] Format image2 detected only with low score of 5, misdetection possible!
[rawvideo @ 0xdf6200] Invalid pixel format.
[image2 @ 0xdf4de0] Failed to open codec in av_find_stream_info
[rawvideo @ 0xdf6200] Invalid pixel format.
[image2 @ 0xdf4de0] Could not find codec parameters for stream 0 (Video: rawvideo, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
0x5C3C6393.raw: could not find codec parameters
Input #0, image2, from '0x5C3C6393.raw':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo, none, 25 tbr, 25 tbn, 25 tbc
[mp4 @ 0xdf6f00] dimensions not set
Output #0, mp4, to 'output.mp4':
    Stream #0:0: Video: rawvideo, none, q=2-31, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Update-

After updating ffmpeg as @slhck suggested and trying the command as suggested by @Gyan (slightly modified), ffmpeg -f h264 -r 15 -i 0x5C3C3031.raw -c copy output_3031.avi, I am getting good avi videos. However, the duration of the output is a little less than the expected duration. Original video should have been 10:54 long, but the output here was 9:54 long. I specified the framerate as 15 (I am comparing the times against videos that are converted by the official tool provided and those videos have 15 fps). Also, on another larger file I tried, the output should have been 59:53 long but it was 57:41. Here is the output of the command ffmpeg -f h264 -r 15 -i 0x5C3C3031.raw -c copy output_3031.avi -

ffmpeg version N-48102-g7cab5471b2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 46.100 / 58. 46.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 3 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 3 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 3 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 3 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] A non-intra slice in an IDR NAL unit.
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 1 times
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 5, skipping.
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 1 times
[h264 @ 0x5ca2540] Invalid NAL unit 5, skipping.
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] non-existing PPS 0 referenced
[h264 @ 0x5ca2540] decode_slice_header error
[h264 @ 0x5ca2540] no frame!
[AVBSFContext @ 0x5cc0440] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 2 times
[h264 @ 0x5ca2540] Invalid NAL unit 8, skipping.
[h264 @ 0x5ca2540] Invalid NAL unit 5, skipping.
[h264 @ 0x5ca2540] Invalid NAL unit 0, skipping.
    Last message repeated 17 times
Input #0, h264, from '0x5C3C3031.raw':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 800x600, 15 fps, 15 tbr, 1200k tbn, 30 tbc
Output #0, avi, to 'output_3031.avi':
  Metadata:
    ISFT            : Lavf58.26.100
    Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuvj420p(pc, bt709, progressive), 800x600, q=2-31, 15 fps, 15 tbr, 15 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[avi @ 0x5cca640] 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
Invalid UE golomb code-1.0 size=  206854kB time=00:22:02.26 bitrate=1281.5kbits/s speed=2.64e+03x
[NULL @ 0x5ca2540] pps_id 3199971767 out of range
[NULL @ 0x5ca2540] illegal POC type 6
[NULL @ 0x5ca2540] SEI type 156 size 488 truncated at 2480.40 bitrate=1281.2kbits/s speed=2.64e+03x
frame=51906 fps=39449 q=-1.0 Lsize=  543722kB time=00:57:41.06 bitrate=1286.9kbits/s speed=2.63e+03x
video:542474kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.229998%
9
  • Please show the complete, uncut command line output. Does ffmpeg -i input.raw -c copy output.mp4 work?
    – slhck
    Commented Feb 12, 2019 at 8:17
  • @slhck, I have edited the question with the required details. Thanks. Commented Feb 12, 2019 at 8:29
  • Thanks. Where does this file come from? (May not be related to the question since the file can't be read without further info, but please update to a recent version of ffmpeg, yours is quite outdated. You can get a static build here: johnvansickle.com/ffmpeg)
    – slhck
    Commented Feb 12, 2019 at 8:31
  • Mediainfo detects this as AVC ES, so, after upgrading, try ffmpeg -f h264 -i 0x5C3C6393.raw -c copy output.mp4
    – Gyan
    Commented Feb 12, 2019 at 8:43
  • @slhck, thanks for your suggestion to upgrade. The file comes from a cctv camera by ACTi, I understand format is proprietary but if mediainfo is able to detect it, there should be some kind of conversion possible, that's what I thought. Commented Feb 12, 2019 at 9:43

1 Answer 1

1

This is not raw. It is AVC, i.e. H.264 Annex B. Looks like Annex B, because from this https://stackoverflow.com/questions/51353973/what-is-different-between-h-265-hevc-in-a-containermp4-mkv-and-h-265-hevc you can see that it inserts 0x000001 that can be recognized as NAL unit 0, to decode that into classic avc you need to use not ffmpeg as it only has h264_mp4toannexb and no h264_annexbtomp4, but there is one here https://github.com/ireader/media-server/commit/76e62c806aaa5e1f97c626a52df0b03c2b2b47b1 Annex B issue here https://trac.ffmpeg.org/ticket/8781

Also ffmpeg version 2.8.15 is so old, it is just crazy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .