user-ag
user-ag

Reputation: 224

FFMPEG : av_open_input_stream in latest ffmpeg

I was trying to read data from a buffer(instead of reading from file) for the purpose of live streaming.In the old version of FFMPEG it was supported using the API "av_open_input_stream". But in the FFMPEG version 2.2.2 this API apppears to be missing. I found the API "avformat_open_input" for reading from a file. Which API shall i use for the purpose of live streaming? It would be very thankfull if you could show the steps for live streaming using the API.

Upvotes: 0

Views: 2719

Answers (2)

Ahmed_Faraz
Ahmed_Faraz

Reputation: 635

You need to use AVIOContext to make a custom read function which will allow you to read data from a buffer instead of video file. The following link might give you some hint http://www.codeproject.com/Tips/489450/Creating-Custom-FFmpeg-IO-Context

Upvotes: 0

Ronald S. Bultje
Ronald S. Bultje

Reputation: 11184

You use avformat_open_input() for all inputs. From APIChanges:

2011-06-16 - 2905e3f / 05e84c9, 2905e3f / 25de595 - lavf 53.4.0 / 53.2.0 - avformat.h Add avformat_open_input and avformat_write_header(). Deprecate av_open_input_stream, av_open_input_file, AVFormatParameters and av_write_header

If you'd like to not block on reading, you're recommended to put the code that calls avformat_read_frame() in a separate thread and pass buffers over a queue to the main thread to do whatever it wants.

Upvotes: 1

Related Questions