26 std::ifstream configFile(configFilename.c_str(), std::ifstream::in);
29 while(std::getline(configFile, line))
31 std::istringstream is_line(line);
33 if(std::getline(is_line, filename,
'='))
36 if(std::getline(is_line, streamId,
':'))
38 std::string transcodeProfile;
39 std::getline(is_line, transcodeProfile);
41 std::stringstream ss(streamId);
42 size_t streamIndex = 0;
44 int subStreamIndex = -1;
51 if(!filename.length())
60 transcoder.
add(filename, streamIndex, subStreamIndex, transcodeProfile, inputCodec);
69 transcoder.
add(filename, streamIndex, subStreamIndex, transcodeProfile, inputCodec);
74 transcoder.
add(filename, streamIndex, subStreamIndex, transcodeProfile);
83 int main(
int argc,
char** argv)
87 help +=
"\tavprocessor CONFIG.TXT OUTPUT_FILE_NAME [--generate-black] [--verbose] [--logFile] [--help]\n";
88 help +=
"CONFIG.TXT\n";
89 help +=
"\tEach line will be one stream in the output.\n";
90 help +=
"\tPattern of each line is:\n";
91 help +=
"\t[inputFile]=STREAM_ID.[subStreamId]:[profileName]\n";
92 help +=
"\tNo inputFile: will generate black image / audio silence (audio by default)\n";
93 help +=
"\tNo subStreamId: will process of channels of the stream\n";
94 help +=
"\tNo profileName: will rewrap the stream\n";
95 help +=
"Command line options\n";
96 help +=
"\t--generate-black: stream which not referred to an input, will generate an output video stream with black "
97 "images (by default generate audio stream with silence)\n";
98 help +=
"\t--verbose: set log level to AV_LOG_DEBUG\n";
99 help +=
"\t--logFile: put log in 'avtranscoder.log' file\n";
100 help +=
"\t--help: display this help\n";
107 std::vector<std::string> arguments;
108 for(
int argument = 1; argument < argc; ++argument)
110 arguments.push_back(argv[argument]);
112 for(
size_t argument = 0; argument < arguments.size(); ++argument)
114 if(arguments.at(argument) ==
"--help")
116 std::cout << help << std::endl;
119 else if(arguments.at(argument) ==
"--generate-black")
123 else if(arguments.at(argument) ==
"--verbose")
127 else if(arguments.at(argument) ==
"--logFile")
136 std::cout <<
"avprocessor can rewrap or transcode inputs to create an output media file." << std::endl;
137 std::cout <<
"Use option --help to display help" << std::endl;
143 std::string inputConfigFile(argv[1]);
154 catch(std::exception& e)
156 std::cerr <<
"ERROR: during process, an error occured: " << e.what() << std::endl;
160 std::cerr <<
"ERROR: during process, an unknown error occured" << std::endl;
static const size_t dummyWidth
static const std::string dummySampleFormat
Description to create a video frame.
static const std::string dummyPixelFormat
Outputfile is the default implentation of wrapper which uses LibAV/FFMpeg.
void setImageParameters(const VideoFrameDesc &videoFrameDesc)
static const std::string dummyVideoCodec
const std::string separator
A Transcoder manages a list of streams, and process a transcode to create an output media file...
static const size_t dummySampleRate
Implementation of IProgress, to display a progress bar in console.
static bool useVideoGenerator
void preloadCodecsAndFormats()
Register all the codecs and formats which are enabled at configuration time.
void parseConfigFile(const std::string &configFilename, avtranscoder::Transcoder &transcoder)
void add(const std::string &filename)
Add all streams of the file with the given filename. All the streams will be rewrapped.
static const std::string dummyAudioCodec
Description to create an audio frame. This corresponds to the number of samples, which corresponds to...
static const size_t dummyChannels
static void logInFile()
Log ffmpeg/libav and avtranscoder informations in a text file.
void setProcessMethod(const EProcessMethod eProcessMethod, const size_t indexBasedStream=0, const double outputDuration=0)
Set the transcoding policy.
void setAudioParameters(const AudioFrameDesc &audioFrameDesc)
int main(int argc, char **argv)
ProcessStat process(IProgress &progress)
Process all the streams, and ended the process depending on the transcode politic.
static const size_t dummyHeight
static void setLogLevel(const int level)
Set the log level of ffmpeg/libav.