I am a novice if you will regarding FFMPEG.
I was tasked with creating a Windows-based C++ project that takes a live webcam stream, does the necessary decoding and encoding, and sends it via RTMP to a server.
The constraints were that the output format be "flv" due to the design of the server end and that it take both audio and video input. Quality of the stream isn't that much of an issue as long as the audio doesn't desync too much from the video.
I drew on the prior works of https://github.com/leixiaohua1020 in simplest_ffmpeg_streamer and simplest_ffmpeg_device.
Specifically, I tried to mesh together the logic behind the readcamera project to provide an input stream and send it to an output address using the streamer part that previously took a local flv video as input.
However, I ran into some problems.
First of all, I know vfwcap is very much outdated but it seems dshow has some problems with the input part as well as the output part so I'm opting for whichever works first.
Second of all, I don't really understand how to set the codec for the input. The input is using rawvideo by default and I tried to add settings as shown.
pFormatCtx->video_codec_id = AV_CODEC_ID_MPEG4;
However, none of the even slightly relevant codec settings seemed to work. All showed the same error message in the vfwcap error message image below.
I would very much appreciate any pointers on achieving 1. change of codec in input stage 2. fixes for the dshow case
I have put the full code up on github with the appropriate mentions.
https://github.com/luorix1/ffmpeg
error message_dshow
error message_vfwcap
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…