I have a script that is going through a media library and re-encoding files to HEVC with ffmpeg and using libx265. The default command I use is:
ffmpeg -i "$origFile" -map 0 -c copy -c:v libx265 -preset slow -crf 28 "$newFile"
However, for some files this process fails, it outputs the following information about the video:
Output #0, matroska, to 'test.mkv':
Metadata:
encoder : Lavf56.15.105
Stream #0:0: Video: hevc, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 23.98 fps
Metadata:
encoder : Lavc57.14.100 libx265
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (copy)
And then, I just get the wall of errors that are printed below here:
[rawvideo @ 000000c56052c920] Invalid buffer size, packet size 295 < expected frame_size 1
769472
Error while decoding stream #0:0: Invalid argument
[rawvideo @ 000000c56052c920] Invalid buffer size, packet size 362 < expected frame_size 1
769472
Error while decoding stream #0:0: Invalid argument
[rawvideo @ 000000c56052c920] Invalid buffer size, packet size 5926 < expected frame_size
1769472
Error while decoding stream #0:0: Invalid argument
[rawvideo @ 000000c56052c920] Invalid buffer size, packet size 406 < expected frame_size 1
769472
Error while decoding stream #0:0: Invalid argument
I've tried following some other advice, since when I try and read the codec, it says "rawvideo", and using commands like ffmpeg -f rawvideo -pix_fmt yuv420p....
, but that also does not work. If anyone has any insight or ability to help explain how to overcome this issue, it would be really appreciated. I've included the ffprobe output for this particular file as well if that is helpful:
ffprobe version N-76479-gc878082 Copyright (c) 2007-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --e
nable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-li
bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libf
reetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libm
p3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable
-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --en
able-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libv
o-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-deckli
nk --enable-zlib
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 14.100 / 57. 14.100
libavformat 57. 14.100 / 57. 14.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 14.101 / 6. 14.101
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, avi, from '109 - The Voices of the Dead.avi':
Metadata:
encoder : Lavf56.15.105
Duration: 00:58:35.47, start: 0.000000, bitrate: 359 kb/s
Stream #0:0: Video: rawvideo, bgr24, 1024x576, 219 kb/s, SAR 1:1 DAR 16:9, 23.98 fps,
23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s
ffmpeg
is too old. Windows users can get a build from Zeranoe.-strict experimental
is no longer needed when encoding 4:2:2 and 4:4:4.-vtag hvc1