Skip to content

Instantly share code, notes, and snippets.

@SergXIIIth
Created November 6, 2015 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SergXIIIth/075c2946cdf68b8717af to your computer and use it in GitHub Desktop.
Save SergXIIIth/075c2946cdf68b8717af to your computer and use it in GitHub Desktop.
Take metadata from video
// gcc src/decoder.c -lavcodec -lavformat
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
int main(int argc, char *argv[]) {
char *filename = "/home/msa/Videos/Cowspiracy.2014.1080p-EGN.mkv";
av_register_all();
AVFormatContext *pFormatCtx = NULL;
int error;
if (error = avformat_open_input(&pFormatCtx, filename, NULL, NULL) < 0) {
printf("Could not open input file '%s' (error '%i')\n", filename, error);
return error;
}
if ((error = avformat_find_stream_info(pFormatCtx, NULL)) < 0) {
fprintf(stderr, "Could not open find stream info (error '%i')\n", error);
avformat_close_input(&pFormatCtx);
return error;
}
av_dump_format(pFormatCtx, 0, filename, 0);
printf("Done");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment