AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
avMeta.cpp
Go to the documentation of this file.
3 
4 #include <iostream>
5 
6 int main(int argc, char** argv)
7 {
8  bool toJson = false;
9 
10  std::string help;
11  help += "Usage\n";
12  help += "\tavmeta INPUT_FILE [--json][--help]\n";
13  help += "Command line options\n";
14  help += "\t--json: print properties as json\n";
15 
16  if(argc < 2)
17  {
18  std::cout << help << std::endl;
19  return (1);
20  }
21 
22  // List command line arguments
23  std::vector<std::string> arguments;
24  for(int argument = 1; argument < argc; ++argument)
25  {
26  arguments.push_back(argv[argument]);
27  }
28  for(size_t argument = 0; argument < arguments.size(); ++argument)
29  {
30  if(arguments.at(argument) == "--help")
31  {
32  std::cout << help << std::endl;
33  return 0;
34  }
35  else if(arguments.at(argument) == "--json")
36  {
37  toJson = true;
38  }
39  }
40 
43 
44  // analyse inputFile
45  avtranscoder::InputFile input(argv[1]);
48 
49  // display file properties
50  if(toJson)
51  std::cout << input.getProperties().allPropertiesAsJson() << std::endl;
52  else
53  std::cout << input;
54 }
int main(int argc, char **argv)
Definition: avMeta.cpp:6
void analyse(IProgress &progress, const EAnalyseLevel level=eAnalyseLevelFirstGop)
Run the analyse on the file after a setup. call this function before getProperties().
Definition: InputFile.cpp:51
std::string allPropertiesAsJson() const
Return all properties as a json format.
void preloadCodecsAndFormats()
Register all the codecs and formats which are enabled at configuration time.
Definition: common.cpp:16
const FileProperties & getProperties() const
Return media properties on the current InputFile.
Definition: InputFile.hpp:71
Implementation of IProgress, to manage cases when we need an IProgress but don't care of a progress b...
static void setLogLevel(const int level)
Set the log level of ffmpeg/libav.
Definition: log.cpp:26