ardour
|
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) | |
virtual | ~TranscodeFfmpeg () |
bool | transcode (std::string, const int outwidth=0, const int outheight=0, const int kbitps=0) |
bool | extract_audio (std::string outfile, ARDOUR::framecnt_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) |
FFSettings | default_encoder_settings () |
FFSettings | default_meta_data () |
void | cancel () |
bool | probe_ok () |
bool | ffexec_ok () |
double | get_fps () |
double | get_aspect () |
int | get_width () |
int | get_height () |
ARDOUR::framecnt_t | get_duration () |
std::string | get_codec () |
FFAudioStreams | get_audio () |
void | set_duration (ARDOUR::framecnt_t d) |
void | set_avoffset (double av_offset) |
void | set_leadinout (double lead_in, double lead_out) |
void | set_fps (double fps) |
void | set_debug (bool onoff) |
Public Member Functions inherited from PBD::ScopedConnectionList | |
ScopedConnectionList () | |
virtual | ~ScopedConnectionList () |
void | add_connection (const UnscopedConnection &c) |
void | drop_connections () |
Public Attributes | |
PBD::Signal2< void, ARDOUR::framecnt_t, ARDOUR::framecnt_t > | Progress |
PBD::Signal0< void > | Finished |
Protected Member Functions | |
bool | probe () |
char * | format_metadata (std::string, std::string) |
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 |
double | m_aspect |
std::string | m_sar |
ARDOUR::framecnt_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 36 of file transcode_ffmpeg.h.
typedef std::vector<FFAudioStream> TranscodeFfmpeg::FFAudioStreams |
Definition at line 46 of file transcode_ffmpeg.h.
typedef std::map<std::string,std::string> TranscodeFfmpeg::FFSettings |
Definition at line 47 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. |
Definition at line 39 of file transcode_ffmpeg.cc.
|
virtual |
Definition at line 79 of file transcode_ffmpeg.cc.
void TranscodeFfmpeg::cancel | ( | ) |
abort any running transcoding process
Definition at line 511 of file transcode_ffmpeg.cc.
TranscodeFfmpeg::FFSettings TranscodeFfmpeg::default_encoder_settings | ( | ) |
Definition at line 260 of file transcode_ffmpeg.cc.
TranscodeFfmpeg::FFSettings TranscodeFfmpeg::default_meta_data | ( | ) |
Definition at line 272 of file transcode_ffmpeg.cc.
bool TranscodeFfmpeg::encode | ( | std::string | outfile, |
std::string | inf_a, | ||
std::string | inf_v, | ||
TranscodeFfmpeg::FFSettings | ffs, | ||
TranscodeFfmpeg::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. Definition at line 306 of file transcode_ffmpeg.cc.
bool TranscodeFfmpeg::extract_audio | ( | std::string | outfile, |
ARDOUR::framecnt_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. Definition at line 403 of file transcode_ffmpeg.cc.
|
inline |
true
if the ffmpeg/ffparse executables are avail on this system Definition at line 97 of file transcode_ffmpeg.h.
|
protected |
Definition at line 526 of file transcode_ffmpeg.cc.
|
protected |
Definition at line 540 of file transcode_ffmpeg.cc.
|
protected |
Definition at line 564 of file transcode_ffmpeg.cc.
|
protected |
Definition at line 534 of file transcode_ffmpeg.cc.
|
protected |
Definition at line 281 of file transcode_ffmpeg.cc.
|
inline |
Definition at line 108 of file transcode_ffmpeg.h.
|
inline |
Definition at line 114 of file transcode_ffmpeg.h.
|
inline |
Definition at line 112 of file transcode_ffmpeg.h.
|
inline |
Definition at line 111 of file transcode_ffmpeg.h.
|
inline |
Definition at line 107 of file transcode_ffmpeg.h.
|
inline |
Definition at line 110 of file transcode_ffmpeg.h.
|
inline |
Definition at line 109 of file transcode_ffmpeg.h.
|
protected |
Definition at line 85 of file transcode_ffmpeg.cc.
|
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 122 of file transcode_ffmpeg.h.
|
inline |
Definition at line 128 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 119 of file transcode_ffmpeg.h.
|
inline |
Definition at line 125 of file transcode_ffmpeg.h.
|
inline |
Definition at line 123 of file transcode_ffmpeg.h.
bool TranscodeFfmpeg::transcode | ( | std::string | outfile, |
const int | outwidth = 0 , |
||
const int | outheight = 0 , |
||
const int | kbitps = 0 |
||
) |
transcode/import a video-file
outfile | full-path (incl. file-extension) |
outwidth | video-width, <0 no scaling) |
outheight | video-height <0 use aspect outwidth /c / aspect-ratio |
kbitps | video bitrate 0 calculate to use 0.7 bits per pixel on average |
true
if the transcoder process was successfully started. Definition at line 452 of file transcode_ffmpeg.cc.
|
protected |
Definition at line 163 of file transcode_ffmpeg.h.
|
protected |
Definition at line 132 of file transcode_ffmpeg.h.
|
protected |
Definition at line 148 of file transcode_ffmpeg.h.
|
protected |
Definition at line 160 of file transcode_ffmpeg.h.
|
protected |
Definition at line 158 of file transcode_ffmpeg.h.
|
protected |
Definition at line 161 of file transcode_ffmpeg.h.
PBD::Signal0<void> TranscodeFfmpeg::Finished |
signal emitted when the transcoder process terminates.
Definition at line 105 of file transcode_ffmpeg.h.
|
protected |
Definition at line 131 of file transcode_ffmpeg.h.
|
protected |
Definition at line 137 of file transcode_ffmpeg.h.
|
protected |
Definition at line 151 of file transcode_ffmpeg.h.
|
protected |
Definition at line 145 of file transcode_ffmpeg.h.
|
protected |
Definition at line 142 of file transcode_ffmpeg.h.
|
protected |
Definition at line 139 of file transcode_ffmpeg.h.
|
protected |
Definition at line 136 of file transcode_ffmpeg.h.
|
protected |
Definition at line 141 of file transcode_ffmpeg.h.
|
protected |
Definition at line 146 of file transcode_ffmpeg.h.
|
protected |
Definition at line 147 of file transcode_ffmpeg.h.
|
protected |
Definition at line 138 of file transcode_ffmpeg.h.
|
protected |
Definition at line 144 of file transcode_ffmpeg.h.
|
protected |
Definition at line 140 of file transcode_ffmpeg.h.
|
protected |
Definition at line 149 of file transcode_ffmpeg.h.
PBD::Signal2<void, ARDOUR::framecnt_t, ARDOUR::framecnt_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 103 of file transcode_ffmpeg.h.