Bulk convert ffmpeg/HandBrakeCli H265/HEVC to H264 error

587 views Asked by At

im running ubuntu VPS (no GUI) and just trying to convert a bunch(approx 100-200) of short clips that are spread into folders A/B/C/ETC - folders SET1/SET2/SET3/ETC and then Scene1.mkv etc. Ive tried with FFMPEG and it converts to mp4 but still HEVC command

for f in *.mkv; do ffmpeg -i "$f" -c:v copy -bsf:v h264_mp4toannexb -vcodec libx264 -c:a aac -preset veryfast "${f%%mkv}mp4"; done

even tried the codec hevc_mp4toannexb but receive the error:

Codec 'h264' (27) is not supported by the bitstream filter 'hevc_mp4toannexb'. Supported codecs are: hevc (173)Error initializing bitstream filter: hevc_mp4toannexb Error initializing output stream 0:0 -- (theyre definitely H265, cant even play on windows media player because of the HEVC error, only VLC player)

decided to give HandBrakeCli a go.

HandBrakeCLI -i scene1.mkv -o scene1.mp4 -e x264 -q 20 -B 160

works perfectly, but now going through stackoverflow to find a bulk code that works. Ive found many but none seem to work. ive tried:

for %F in *.mkv do HandBrakeCLI -e x264 -q 20 -B 160 -i "%F" -o "%~nF.mp4"

blanks out.

and

for %%F in *.mkv;
 do HandBrakeCLI -i -Z "Fast 1080p30" -o %%~nF.mp4 -e x264 -q 20 -B 160;
done

with the error:

bash: `%%F': not a valid identifier

and even tried some solutions like > HandBrakeCLI bash script convert all videos in a folder but with no luck.

any help would be greatly appreciated. i just cant

0

There are 0 answers