Convert video from x265 to x264 codecs with Raspberry Pi

Recently I realized that the x265 codecs are not using the GPU as the x264 codecs does, at least in Linux. Then, you need a quite new CPU to smoothly reproduce these videos, which is quite annoying for people using a Raspberry Pi or a similar device as home-cinema. Like me.

Well, I downloaded a whole series encoded with this x265 codecs. And after a few minutes cursing this crazy-codecs world, I decided to take my time and learning how to transform videos from x265 to x264 format (the good and fast one). This re-encoding process takes about 2x or 3x the time of each video, which means several hours for a whole series, so I preferred to use my Raspberry Pi server to do the process during the nights.

(By the way, to see how to install ffmpeg and x265 support on Ubuntu 14.04, click here)

First, I needed the last version of ffmpeg command, with both x265 and x264 support in my Raspberry. Sadly, there is no packages for that, so I had to download, compile and install them. This is the whole process:

Install dependencies:

x265 codecs:

Download source, compile and install:

After the next command, it will ask you for cmake option. Press c to configure and g to generate and exit:

Compile and install:

 

ffmpeg with x264 support:

Download, compile and install the last version of ffmpeg (with x264):

x264 codecs:

The -j4 param for the make command is just in case you have a Model B+, so you can take advantaje of all their 4 cores ūüôā

ffmpeg:

Note the -j4 param again…

And that’s it!.

Now, to convert a video file:


I also make a quick script to launch this command for a list of files. It is something like this. Please don’t take it as it is, it is too simple, just adapt it to your needs:

Usage example:


By the way, you can also install ffmpeg and x265 support on Ubuntu 14.04, and then you can use the same command for converting videos as mentioned above:

ffmpeg:

x265 codecs:


Thanks to:

http://raspberrypi.stackexchange.com/a/33816
http://www.jeffreythompson.org/blog/2014/11/13/installing-ffmpeg-for-raspberry-pi/
http://askubuntu.com/questions/362745/how-to-install-h-265-hevc-codec-on-ubuntu-linux
http://www.noobslab.com/2014/12/ffmpeg-returns-to-ubuntu-1410.html

 
Tagged , , , , . Bookmark the permalink.

2 Responses to Convert video from x265 to x264 codecs with Raspberry Pi

  1. fil says:

    Hi,

    Raspberry PI 2? how many fps ?

     

  2. Eloi says:

    From my experience, you need to add¬† –enable-libx265 to the ffmpeg’s configure command.
    I got “Unrecognized option ‘x265-params'” when strictly following your guide. Now it works for me.
    However, I can’t get libx264 to encode, but that’s another subject.

Leave a Reply

Your email address will not be published. Required fields are marked *