mediainfo
в файле дает следующий вывод -
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 : Main@L3.1
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
Я пробовал ffmpeg -f rawvideo -pixel_format yuv420p -video_size 800x600 -framerate 15 -i 0x5C3C6393.raw test.avi
, но это не работает. Вывод этой команды -
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%
Вывод 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
Обновить-
После обновления ffmpeg в соответствии с предложением @slhck и пробуя команду, предложенную @Gyan (слегка изменено), ffmpeg -f h264 -r 15 -i 0x5C3C3031.raw -c copy output_3031.avi
, я получаю хорошие видео avi. Однако длительность вывода немного меньше ожидаемой. Исходное видео должно было иметь длину 10:54, но на выходе - 9:54. Я указал частоту кадров 15 (я сравниваю время с видео, которые конвертируются с помощью предоставленного официального инструмента, и эти видео имеют 15 кадров в секунду). Кроме того, на другом файле большего размера, который я пробовал, вывод должен был быть 59:53, но это было 57:41. Вот выходные данные команды 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%