Ffmpeg: How to set AVFormatContext from NSData

I use the FFmpeg library in Objective-C.

I want to set AVFormatContext from NSData that contain imagedata. I know that I can set AVFormatContext with av_open_input_file (). therefore, by writing the contents of NSData to a temporary file, I can do this as follows.


[data writeToFile:@"./temp.mov" atomically:YES];
av_open_input_file(&pFormatCtx, "./temp.mov", NULL, 0, NULL);

.
.
.

NSFileManager *fm = [NSFileManager defaultManager];
[fm removeFileAtPath:@"./temp.mov" handler:nil];

but I do not want to use a temporary file.

Does anyone know a smart way?

Sorry, my bad english.

thank

+5
source share

All Articles