Ardour
9.0-pre0-582-g084a23a80d
|
wrapper around ffmpeg and ffprobe command-line utils More...
#include <transcode_ffmpeg.h>
Classes | |
struct | FFAudioStream |
Public Types | |
typedef std::vector< FFAudioStream > | FFAudioStreams |
typedef std::map< std::string, std::string > | FFSettings |
Public Member Functions | |
TranscodeFfmpeg (std::string f) | |
bool | transcode (std::string outfile, const int width=0, const int height=0, const int kbitps=0) |
bool | extract_audio (std::string outfile, ARDOUR::samplecnt_t samplerate, unsigned int stream=0) |
bool | encode (std::string outfile, std::string inf_a, std::string inf_v, FFSettings ffs, FFSettings meta, bool map=true) |
void | cancel () |
FFSettings | default_encoder_settings () |
FFSettings | default_meta_data () |
bool | probe_ok () |
bool | ffexec_ok () |
double | get_fps () |
double | get_aspect () |
int | get_width () |
int | get_height () |
ARDOUR::samplecnt_t | get_duration () |
std::string | get_codec () |
FFAudioStreams | get_audio () |
void | set_duration (ARDOUR::samplecnt_t d) |
void | set_avoffset (double av_offset) |
void | set_leadinout (double lead_in, double lead_out) |
void | set_debug (bool onoff) |
Public Member Functions inherited from PBD::ScopedConnectionList | |
ScopedConnectionList () | |
ScopedConnectionList (const ScopedConnectionList &)=delete | |
ScopedConnectionList & | operator= (const ScopedConnectionList &)=delete |
virtual | ~ScopedConnectionList () |
void | add_connection (const UnscopedConnection &c) |
void | drop_connections () |
Public Attributes | |
PBD::Signal< void(ARDOUR::samplecnt_t, ARDOUR::samplecnt_t)> | Progress |
PBD::Signal< void(int)> | Finished |
Protected Member Functions | |
bool | probe () |
void | ffmpegparse_v (std::string d, size_t s) |
void | ffmpegparse_a (std::string d, size_t s) |
void | ffprobeparse (std::string d, size_t s) |
void | ffexit () |
Protected Attributes | |
std::string | infile |
ARDOUR::SystemExec * | ffcmd |
double | m_fps |
std::string | m_fps_str |
double | m_aspect |
std::string | m_sar |
ARDOUR::samplecnt_t | m_duration |
int | m_width |
int | m_height |
std::string | m_codec |
int | m_videoidx |
double | m_avoffset |
double | m_lead_in |
double | m_lead_out |
bool | ffexecok |
bool | probeok |
FFAudioStreams | m_audio |
std::string | ffoutput |
std::string | ffmpeg_exe |
std::string | ffprobe_exe |
bool | debug_enable |
wrapper around ffmpeg and ffprobe command-line utils
This class includes parsers for stdi/o communication with 'ffmpeg' and 'ffprobe' and provide an abstraction to transcode video-files and extract aufio tracks and query file information.
Definition at line 33 of file transcode_ffmpeg.h.
typedef std::vector<FFAudioStream> TranscodeFfmpeg::FFAudioStreams |
Definition at line 42 of file transcode_ffmpeg.h.
typedef std::map<std::string, std::string> TranscodeFfmpeg::FFSettings |
Definition at line 43 of file transcode_ffmpeg.h.
TranscodeFfmpeg::TranscodeFfmpeg | ( | std::string | f | ) |
instantiate a new transcoder. If a file-name is given, the file's attributes (fps, duration, geometry etc) are read.
f | path to the video-file to probe or use as input for extract_audio and transcode . |
void TranscodeFfmpeg::cancel | ( | ) |
abort any running transcoding process
FFSettings TranscodeFfmpeg::default_encoder_settings | ( | ) |
FFSettings TranscodeFfmpeg::default_meta_data | ( | ) |
bool TranscodeFfmpeg::encode | ( | std::string | outfile, |
std::string | inf_a, | ||
std::string | inf_v, | ||
FFSettings | ffs, | ||
FFSettings | meta, | ||
bool | map = true |
||
) |
transcode video and mux audio files into a new video-file.
outfile | full-path of output file to create (existing files are overwritten) |
inf_a | filename of input audio-file |
inf_v | filename of input video-file |
ffs | additional command-line parameters for 'ffmpeg'. key/value pairs eg ffs["-vcodec"] = "mpeg4" |
meta | additional meta-data results in -metadata "<key>"="<value>" command-line arguments |
map | if set to true stream mapping from input streams to output streams is set to use only the first available stream from the audio & video file (-map 0.0 -map 1.0). |
true
if the encoder process was successfully started. bool TranscodeFfmpeg::extract_audio | ( | std::string | outfile, |
ARDOUR::samplecnt_t | samplerate, | ||
unsigned int | stream = 0 |
||
) |
Extract an audio track from the given input file to a new 32bit float little-endian PCM WAV file.
outfile | full-path (incl. file-extension) to .wav file to write |
samplerate | target samplerate |
stream | Stream-ID of the audio-track to extract specified as element-number in get_audio(). |
true
if the transcoder process was successfully started.
|
inline |
true
if the ffmpeg/ffparse executables are avail on this system Definition at line 101 of file transcode_ffmpeg.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
Definition at line 111 of file transcode_ffmpeg.h.
|
inline |
Definition at line 136 of file transcode_ffmpeg.h.
|
inline |
Definition at line 131 of file transcode_ffmpeg.h.
|
inline |
Definition at line 126 of file transcode_ffmpeg.h.
|
inline |
Definition at line 106 of file transcode_ffmpeg.h.
|
inline |
Definition at line 121 of file transcode_ffmpeg.h.
|
inline |
Definition at line 116 of file transcode_ffmpeg.h.
|
protected |
|
inline |
true
if the input file was parsed correctly on class creation. Definition at line 95 of file transcode_ffmpeg.h.
|
inline |
Definition at line 150 of file transcode_ffmpeg.h.
|
inline |
Definition at line 161 of file transcode_ffmpeg.h.
|
inline |
override file duration used with the Progress signal.
d | duration in video-frames = length_in_seconds * get_fps() |
Definition at line 144 of file transcode_ffmpeg.h.
|
inline |
Definition at line 155 of file transcode_ffmpeg.h.
bool TranscodeFfmpeg::transcode | ( | std::string | outfile, |
const int | width = 0 , |
||
const int | height = 0 , |
||
const int | kbitps = 0 |
||
) |
transcode to (import a video-file)
outfile | full-path (incl. file-extension) of the file to create |
width | video-width, if <0 no scaling |
height | video-height, with <0 preserve aspect (width / aspect-ratio ) |
kbitps | video bitrate, with 0 calculate to use 0.7 bits per pixel on average |
true
if the transcoder process was successfully started.
|
protected |
Definition at line 202 of file transcode_ffmpeg.h.
|
protected |
Definition at line 183 of file transcode_ffmpeg.h.
|
protected |
Definition at line 196 of file transcode_ffmpeg.h.
|
protected |
Definition at line 200 of file transcode_ffmpeg.h.
|
protected |
Definition at line 199 of file transcode_ffmpeg.h.
|
protected |
Definition at line 201 of file transcode_ffmpeg.h.
PBD::Signal<void(int)> TranscodeFfmpeg::Finished |
signal emitted when the transcoder process terminates.
Definition at line 173 of file transcode_ffmpeg.h.
|
protected |
Definition at line 182 of file transcode_ffmpeg.h.
|
protected |
Definition at line 186 of file transcode_ffmpeg.h.
|
protected |
Definition at line 198 of file transcode_ffmpeg.h.
|
protected |
Definition at line 193 of file transcode_ffmpeg.h.
|
protected |
Definition at line 191 of file transcode_ffmpeg.h.
|
protected |
Definition at line 188 of file transcode_ffmpeg.h.
|
protected |
Definition at line 184 of file transcode_ffmpeg.h.
|
protected |
Definition at line 185 of file transcode_ffmpeg.h.
|
protected |
Definition at line 190 of file transcode_ffmpeg.h.
|
protected |
Definition at line 194 of file transcode_ffmpeg.h.
|
protected |
Definition at line 195 of file transcode_ffmpeg.h.
|
protected |
Definition at line 187 of file transcode_ffmpeg.h.
|
protected |
Definition at line 192 of file transcode_ffmpeg.h.
|
protected |
Definition at line 189 of file transcode_ffmpeg.h.
|
protected |
Definition at line 197 of file transcode_ffmpeg.h.
PBD::Signal<void(ARDOUR::samplecnt_t, ARDOUR::samplecnt_t)> TranscodeFfmpeg::Progress |
signal emitted when ffmpeg reports progress updates during encode transcode and extract_audio The parameters are current and last video-frame.
Definition at line 170 of file transcode_ffmpeg.h.