I've been experimenting with ffmpeg since some time now; and recently joined the forums. I first set up Linux environment, then also the Windows environment. Since I'm more comfortable with Windows, decided to carry on with experimentation with Windows only.
I want to read input stream from a webcam (currently I'm using SoC PC-Camera as input), decode the stream, encode it into h264 format, and save (and eventually) transmit it over RTP/UDP, or RTSP. With files residing on HDisk, I can do the decode/encode sequence as well as UDP transmission successfully (only video part, which is also very buggy), but it works to start.
Now I want to read live stream from this webcam; so when I call avformat_open_input() function and specify "video=SoC PC-Camera" as input (also only "SoC PC-Camera"), it does not work (gives me error -2). Since on Windows we have only dll files, I cannot debug into code. So I ported it back on Linux box, and tried debugging there; but am still clueless why this is not opening properly.
This is example code of what I do:
- Code: Select all
const char ip = "SoC PC-Camera";
AVFormatContext* pInputFileFormatCtx = NULL;
int rv = avformat_open_input(pInputFileFormatCtx, ip, NULL, NULL);
Of course I've chopped off lots of code unrelated to this question.
Can anyone tell me what I could be doing wrong; also, isn't there code sample anywhere that can tell me how to steam from live webcam?
Thanks in advance for any guidance!