Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE

This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Stream video into RTSP programatically

A collection of useful tutorials for some common tasks.

Stream video into RTSP programatically

Postby sercasyr » Tue May 16, 2017 12:21 pm

Hi, I would like to PROGRAMATICALLY get a video stream and stream it to RTMP.

Right now I am using an NGINX server that I have running on "rtmp://localhost/myapp/webcam".
Later I would try to get the video from images stored in memory, but at this moment it is enough to get the video from "/dev/video0" (a webcam).

The NGINX server works as I have tried other examples with (command line) ffmpeg and ffplay and it works.
However, I need to do it programatically. I don't really know if the NGINX server is really necessary. I am a total newbie in ffmpeg and video streaming.

Honestly, I don't know where to start from. I have tried this example from GitHUB (changing only the input to /dev/video0):

leixiaohua1020/simplest_ffmpeg_streamer (I cannot post a link here)

But I am cannot make it work. It reads the input but I get stuck at this part:

Code: Select all
//Write file header
ret = avformat_write_header(ofmt_ctx, NULL);
if (ret < 0) {
printf( "Error occurred when opening output URL\n");
goto end;

ret has a value of -38 (Error code meaning "Function not implemented").

Has someone any idea of how I can stream a video into RTMP programatically?
Has anybody a working example of what I try to do?
Any idea of why the code I show does not work?
Posts: 1
Joined: Tue May 16, 2017 11:46 am

Re: Stream video into RTSP programatically

Postby llogan » Tue May 16, 2017 7:25 pm

Questions involving the usage of the FFmpeg libraries should be asked at the libav-user mailing list.
Get an answer more quickly by providing your actual ffmpeg command and the complete console output. Use the code button to format your command and output or your question will be ignored.
Posts: 2363
Joined: Fri Jan 25, 2013 9:47 pm
Location: Alaska

Return to Tutorials

Who is online

Users browsing this forum: Google [Bot] and 2 guests