HomerHEVC encoder and GPAC
This is an invited article from Juan Casal of HomerHEVC. This article belongs the "GPAC industry use-cases" category which shows how industry actors use GPAC in their projects. Please click here to read the original version of this article.
Creating HEVC videos in .mp4 and .ts format using HomerHEVC and GPAC
This tutorial aims at showing how to combine HomerHEVC and GPAC to create HEVC content that should be valid for any player that supports HEVC decoding.
The following steps show:
- how to encode raw videos in HEVC using HomerHEVC,
- how to encapsulate the HEVC bitstream in a MPEG2 Transport Stream or
- how to encapsulate the HEVC bitstream in a MP4 file using GPAC and
- how to play it using MP4Client player from GPAC.
The entire process is collected in a Python script that can be downloaded from HomerHEVC repository in Github:
1- Download HomerHEVC latest release executable for windows from sourceforge (https://sourceforge.net/projects/homerhevc/files/) or HomerHEVC source code from GitHub (https://github.com/jcasal-homer/HomerHEVC/releases). Linux users please download and compile the code.
2- If you have downloaded the source code, compile HomerHEVC following the instructions in http://homerhevc.com/developers-corner/compilation-usage/
3- Encode your raw file by calling HomerHEVC application.
The following command gives a configuration example. Remember to modify and adapt the configuration to your content (resolution, framerate or bitrate).
C:\HomerHEVC\homer_app -i input_file.yuv -o output_file.265 -widthxheight 1280x720 -intra_period 100 -n_frames 4000 -sao 1 -frame_rate 25 -bitrate 800 -performance_mode 2
For HomerHEVC configuration help, call:
4- Download and install GPAC from http://gpac.io/downloads/gpac-nightly-builds/. This package includes the Mp4Box and the mp42ts utilities and the MP4Client player.
5- Encapsulate the HEVC bitstream (.265) in an .mp4 file using GPAC. Again you have to adapt the framerate (fps) to your content properties.
C:\GPAC\MP4Box -add output_file.265:fps=25 -new demo_video.mp4
For MP4Box configuration help call:
6- Encapsulate the .mp4 file in a MPEG2 Transport Stream (.ts).
C:\GPAC\mp42ts -prog demo_video.mp4 -dst-file demo_video.ts
For mp42ts configuration help call:
At this point the HEVC encoded and encapsulated .mp4 or .ts video file should be able to be played in any HEVC player.
7- Open the MP4Client player from the GPAC installation path and play the .mp4 or the .ts file.
This can also be done with the following commands:
MP4Client playing .mp4 file created using HomerHEVC and GPAC
If you want to know more about the HomerHEVC encoder, please visit their website.