how to conver a m4v(mpeg) codec raw video to a mp4 file which can be played?

1k Views Asked by At

I uses the following command that can extract the mpeg4 raw video file:

ffmpeg -i D:\mp4v-mp4\test\360.mov -vcodec copy -an -f rawvideo D:\mp4v-mp4\test\360CmdSplit_std.dat

but how can I convert the rawvideo file back to a playable mp4 file. I have tried the follow cmd, but failed:

ffmpeg -y -f m4v -i D:\mp4v-mp4\test\360CmdSplit_std1.dat -vcodec copy D:\mp4v-mp4\test\tmp360.mp4
1

There are 1 best solutions below

1
Henry Hu On

the first cmd(extract the raw mp4v video) is success,logs: D:\install\ffmpeg-4.3.1-essentials_build\bin>ffmpeg.exe -i D:\mp4v-mp4\MOV\360(mp4v_aac).mov -vcodec copy -an -f rawvideo D:\mp4v-mp4\MOV\360mov_std.dat ffmpeg version 4.3.1-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10.2.0 (Rev1, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband 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 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\mp4v-mp4\MOV\360(mp4v_aac).mov': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt encoder : Lavf58.17.101 Duration: 00:00:52.08, start: 0.000000, bitrate: 408 kb/s Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 360x240 [SAR 1:1 DAR 3:2], 277 kb/s, 24 fps, 24 tbr, 12288 tbn, 24 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc58.22.101 mpeg4 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: handler_name : SoundHandler Output #0, rawvideo, to 'D:\mp4v-mp4\MOV\360mov_std.dat': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt encoder : Lavf58.45.100 Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 360x240 [SAR 1:1 DAR 3:2], q=2-31, 277 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc58.22.101 mpeg4 Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 1250 fps=0.0 q=-1.0 Lsize= 1764kB time=00:00:52.08 bitrate= 277.5kbits/s speed=1.47e+03x video:1764kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

convert the rawvideo file back to a playable mp4 file,failed:

D:\install\ffmpeg-4.3.1-essentials_build\bin>ffmpeg -y -f m4v -i D:\mp4v-mp4\MOV\360mov_std.dat -vcodec copy D:\mp4v-mp4\MOV\tmp360.mp4 ffmpeg version 4.3.1-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10.2.0 (Rev1, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband 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 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 [mpeg4 @ 00000214e53d47c0] time_increment_bits 0 is invalid in relation to the current bitstream, this is likely caused by a missing VOL header [mpeg4 @ 00000214e53d47c0] time_increment_bits set to 5 bits, based on bitstream analysis [mpeg4 @ 00000214e53d47c0] time_increment_bits 4 is invalid in relation to the current bitstream, this is likely caused by a missing VOL header [mpeg4 @ 00000214e53d47c0] time_increment_bits set to 5 bits, based on bitstream analysis [mpeg4 @ 00000214e53d47c0] looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag [m4v @ 00000214e53cab40] decoding for stream 0 failed [m4v @ 00000214e53cab40] Could not find codec parameters for stream 0 (Video: mpeg4, yuv420p): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, m4v, from 'D:\mp4v-mp4\MOV\360mov_std.dat': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: mpeg4, yuv420p, 25 fps, 25 tbr, 1200k tbn, 25 tbc [mp4 @ 00000214e543a840] dimensions not set Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Stream mapping: Stream #0:0 -> #0:0 (copy) Last message repeated 1 times