Scales a 480p (854x480) video up to Full HD 1080p (1920x1080) using AVBlocks Transcoder with hardcoded input and output file paths.
This sample demonstrates the basic AVBlocks video upscaling workflow:
- Initialize the AVBlocks library
- Create a
MediaInfoobject to probe the input file - Create an input
MediaSocketfrom the probed media info - Clone the input socket to start with an identical output configuration
- Set the output frame size to 1920x1080 on the output video pin
- Set the resize interpolation method to
Cubic, best for upscaling quality - Configure a
Transcoderwith the input and output sockets - Run the transcode operation
No command line parsing is used — the input and output file paths are hardcoded in the source code.
From the repository root:
mkdir -p build/debug_x64
cd build/debug_x64
cmake -G 'Ninja' -DCMAKE_BUILD_TYPE=debug -DPLATFORM=x64 ../../samples
ninjaThe built executable will be placed in bin/x64/simple_video_upscale.
From the repository root:
mkdir -p build/debug_arm64
cd build/debug_arm64
cmake -G 'Ninja' -DCMAKE_BUILD_TYPE=debug -DPLATFORM=arm64 ../../samples
ninjaThe built executable will be placed in bin/arm64/simple_video_upscale.
-
Download the sample video, the MP4 file from the TED talk video What's the next window into our universe? by Andrew Connolly (480p, 854x480):
curl -L -o AndrewConnolly_2014.mp4 \ https://archive.org/download/AndrewConnolly_2014/AndrewConnolly_2014.mp4 -
Run the sample from the sample directory (the input/output file paths are relative to the working directory):
cd samples/linux/simple_video_upscale ../../../bin/x64/simple_video_upscale -
The upscaled output file
AndrewConnolly_2014_1080p.mp4will be created in thesamples/linux/simple_video_upscaledirectory.
-
Download the sample video, the MP4 file from the TED talk video What's the next window into our universe? by Andrew Connolly (480p, 854x480):
cd samples/linux/simple_video_upscale curl -L -o AndrewConnolly_2014.mp4 \ https://archive.org/download/AndrewConnolly_2014/AndrewConnolly_2014.mp4 -
Run the sample from the sample directory (the input/output file paths are relative to the working directory):
../../../bin/arm64/simple_video_upscale
-
The upscaled output file
AndrewConnolly_2014_1080p.mp4will be created in thesamples/linux/simple_video_upscaledirectory.
- The input file
AndrewConnolly_2014.mp4and output fileAndrewConnolly_2014_1080p.mp4paths are hardcoded insimple_video_upscale.cpp. They are relative to the working directory from which the executable is run. - If
transcoder->open()fails, it may be becauseAndrewConnolly_2014_1080p.mp4already exists in the directory. Delete the output file and try again. - The output video stream is resized to 1920x1080 (Full HD) using
InterpolationMethod::Cubic, which gives the best upscaling quality at the cost of speed. The audio stream is copied from the source as is.