Skip to content

Conversation

@joelmacx
Copy link
Collaborator

@joelmacx joelmacx commented Dec 4, 2025

Description

The old GPAC API usage was sometimes silently corrupting output muxed video files. This seems to have been somewhat dependent on the shape of the input IAMF files.

Although the GPAC CLI uses identical filters as the API here, it split muxing into 2 stages: audio writes then video writes. This PR replicates that flow in the API usage. This seems to resolve NAL errors in output MP4s.

Changes

  1. Refactored muxing flow into 2 distinct portions handling audio then video.
  2. Added test coverage using ffprobe to better verify output muxed files.
  3. Added additional video test sources. These include .mp4 and .mov containers with H264, H265, and AV1 encoded video streams.
  4. Bumped GPAC version and made it a dylib.

Validation and Acceptance Criteria

  • Added test coverage and verification methods.
  • Validated export in Pro Tools.
  • Verified YouTube uploads and processes files that have gone through the plugin.

@joelmacx
Copy link
Collaborator Author

joelmacx commented Dec 4, 2025

  • Establish how we want to handle 3rd party libs like GPAC between architectures now.

@joelmacx
Copy link
Collaborator Author

joelmacx commented Dec 4, 2025

  • GPAC rpaths in dylib
  • Export through DAW

Copy link
Collaborator

@BrandenAvalonCx BrandenAvalonCx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I like this approach but I think there's a bit of cleanup needed here

const juce::String outputMuxdFile = exportData.getVideoExportFolder();
// Checks for errors in the muxed file using ffmpeg and verifies presence of an
// IAMF audio stream and video stream
bool validateMuxedFile(const juce::String& path) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should be part of unit testing rather then in one of the main files?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting that popen and pclose can't be used in Windows, so this won't build. Maybe this can be moved to a MacOS only build for now, or we can use something cross platform, though cross platform application execution is one of the reasons I don't really like this type of command execution.

// Checks for errors in the muxed file using ffmpeg and verifies presence of an
// IAMF audio stream and video stream
bool validateMuxedFile(const juce::String& path) {
#ifndef ECLIPSA_FFMPEG_AVAILABLE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit odd to compile this in or out here rather then including or removing the unit tests. If you want to check here I would check in a non-compile based way, but I have no problem with not checking here either and letting the validator fail if FFMPEG is not present.


FILE* pipe = popen(ffmpegCommand.toRawUTF8(), "r");
if (!pipe) {
std::cout << "Failed to execute ffmpeg command" << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be log statements?

std::string errStr = "IAMF Muxing: Failed to load audio file: " +
inputAudioFile.toStdString();
LOG_ERROR(0, errStr);
LOG_ERROR(0, "IAMF Audio Muxing: Failed to load audio file.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we output information about the file we're failing to load, to make debugging easier

std::string errStr = "IAMF Muxing: Failed to load video file: " +
inputVideoFile.toStdString();
LOG_ERROR(0, errStr);
LOG_ERROR(0, "Video Interleaving: Failed to load video file.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we output information about the video file we're failing to load?

if (!std::filesystem::exists(inputVideoFile.toStdString())) {
LOG_ERROR(0, "IAMF Muxing: Input video file" +
inputVideoFile.toStdString() + " does not exist.");
std::cout << "IAMF Muxing: Input video file" +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't logging be enough here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is something supposed to be here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in third_party/gpac?

@joelmacx joelmacx closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants