DEV Community

hexfloor
hexfloor

Posted on

More storage for media : organize files using ChatGPT : part 3, converting MOV to HEVC MPEG-4

Main article

Introduction

You might wish to know more about MOV, MPEG-4 and HEVC. You may prompt ChatGPT on my choice of the end format, there are pros and cons, get to know about VVC.

Setup

Given my past experience I will build ffmpeg from sources with HEVC support.

sudo apt update
sudo apt install -y build-essential pkg-config git yasm libx264-dev libx265-dev libnuma-dev libfdk-aac-dev libmp3lame-dev libopus-dev libvpx-dev
sudo apt install nasm
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
Enter fullscreen mode Exit fullscreen mode

My favorite part:

./configure --enable-gpl --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvpx --enable-nonfree
make
sudo make install
Enter fullscreen mode Exit fullscreen mode

Checking:

ffmpeg -codecs | grep hevc
Enter fullscreen mode Exit fullscreen mode

Image description
Great!
Clean up:

cd ..
rm -rf ffmpeg
Enter fullscreen mode Exit fullscreen mode

convert MOV to MPEG-4 HEVC using ffmpeg

The setup is a complicated part, all the rest is trivial.

ffmpeg -i input.mov -c:v libx265 -crf 23 -preset medium -c:a aac -b:a 192k output.mp4
Enter fullscreen mode Exit fullscreen mode

Image description
Feel free to use the settings that reflect your need.

Bonus

This should be a good start for you:

Hi ChatGPT, I wish to compress some old videos of mine into the mp4 hevc with normal quality, possibly with some loss, and my best wish would be to reduce the file size as much as we can, however preserving the quality, could you please suggest me the resolution and the bitrate in one line, and the ffmpeg command in the second line ? Short answer, thank you !

Image description

ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 28 -vf "scale=1280:720" -b:v 1500k output.mp4

Enter fullscreen mode Exit fullscreen mode

Top comments (0)