darbyjohnston / tlRender

tlRender is an open source library for building playback and review applications for visual effects, film, and animation.
BSD 3-Clause "New" or "Revised" License
193 stars 22 forks source link

Save FFmpeg movies with audio #129

Closed ggarra13 closed 9 months ago

ggarra13 commented 1 year ago

This PR heavily modifies the FFmpegWrite.cpp to allow saving audio (or even audio only without video) with a new writeAudio() function in the Plugin API. It also adds more extensions to those supported by our FFmpeg reader.

Audio Codec selection can be done through an ioOption. It supports resampling of the audio as well as dealing with planar/interleaved audio and handles timecode as metadata if provided.

The code has been tested in mrv2 v0.8.3 with BART_* (44100 Hz. Mono), Dinky (48000 Hz. Stereo), elemental trailer ( 44100 Hz. Stereo with timecode), WonderWoman (44100 Hz. Stereo), dolby-spheres (96000 Hz. 7:1 8 Channels), AudioToneStereo.wav (44100 Hz Stereo no video, but currently, you still need to define a video container like .mov even if only audio gets saved).

Note: in order to handle the new FFmpeg API on Windows, it is necessary to compile FFmpegWriter.cpp with C++20, which is handled in the CMakeLists.txt file.