Cables GL, fffmpeg & videoPlayback
Video Playback Performance in CABLES GL: A Solutions Guide
During our migration to CABLES GL, we encountered several challenges with video playback, particularly around performance. While we previously achieved impressive results using the HAP codec in openFrameworks (capable of decoding multiple 4K streams in real-time), we’ve had to adjust our expectations for the CABLES GL environment.
Our current priority has been establishing stable, crash-free playback for a single video stream. Future improvements will focus on advanced features like scrubbing, alpha channel support, and 4K resolution handling.
After extensive testing with the VideoTexture node, we’ve found a conversion approach that consistently outperforms other methods. Below is our Windows batch conversion tool that utilizes specific FFmpeg parameters which have proven most effective in our environment.
Though I can’t fully explain the technical reasons behind its superior performance, this solution has significantly reduced crashes and improved playback stability.
Feel free to try these conversion settings if you’re facing similar challenges with CABLES GL video implementation or comment if you found the why !
@echo off
setlocal enabledelayedexpansion
# Use current directory for input
set "input_dir=%cd%"
# Create output directory as a subfolder of current directory
set "output_dir=%cd%\converted"
# Create output directory if it doesn't exist
if not exist "%output_dir%" mkdir "%output_dir%"
echo Input directory: %input_dir%
echo Output directory: %output_dir%
# Process each MP4 file in the current directory
for %%f in ("*.mp4") do (
# Skip already converted files if they exist in the output folder
if not "%%~nxf"=="converted\%%~nxf" (
echo Processing: %%~nxf
ffmpeg -i "%%f" -an -movflags +faststart -brand mp42 -pix_fmt yuv420p -profile:v baseline -level 3.0 "%output_dir%\%%~nxf"
echo Completed: %%~nxf
)
)
echo All videos processed!
Linux version
#!/bin/bash
# Use current directory for input
input_dir="$(pwd)"
# Create output directory as a subfolder of current directory
output_dir="$(pwd)/converted"
# Create output directory if it doesn't exist
if [ ! -d "$output_dir" ]; then
mkdir -p "$output_dir"
fi
echo "Input directory: $input_dir"
echo "Output directory: $output_dir"
# Process each MP4 file in the current directory
for file in *.mp4; do
# Skip if no mp4 files exist
if [ ! -f "$file" ]; then
echo "No MP4 files found in the current directory."
break
fi
# Skip already converted files if they exist in the output folder
if [ "$file" != "converted/$file" ]; then
echo "Processing: $file"
ffmpeg -i "$file" -an -movflags +faststart -brand mp42 -pix_fmt yuv420p -profile:v baseline -level 3.0 "$output_dir/$file"
echo "Completed: $file"
fi
done
echo "All videos processed!"