Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ffmpeg/avcodec.h>
- #include <ffmpeg/avformat.h>
- #include <stdio.h>
- int main() {
- AVFormatContext *pFormatCtx = NULL;
- AVFormatParameters formatParams ;
- AVInputFormat *iformat = NULL;
- av_register_all();
- formatParams.standard = NULL;
- formatParams.width = 320;
- formatParams.height = 280;
- iformat = av_find_input_format("video4linux");
- if (iformat == NULL) {
- printf("No format found\n");
- return -2;
- }
- printf("%d\n",av_open_input_file(&pFormatCtx,"/dev/video0", iformat, 0, &formatParams));
- if (av_open_input_file(&pFormatCtx,"/dev/video0", iformat, 0, &formatParams) != 0) {
- printf("Error");
- return -2;
- }
- int i;
- if(av_find_stream_info(pFormatCtx)<0)
- return -1; // Couldn't find stream information
- dump_format(pFormatCtx, 0, "/dev/video0", 0);
- av_close_input_file(pFormatCtx);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement