jkuri / opencv-ffmpeg-rtmp-stream

OpenCV FFMpeg Live Video Stream over RTMP protocol.
MIT License
210 stars 59 forks source link

Problem with streamming to wowza #3

Open DuongHieuMAI opened 6 years ago

DuongHieuMAI commented 6 years ago

Hi @jkuri Thank you for sharing your source code. I changed the out put to stream to wowza server. But there were two lines across the frame like this: https://cl.ly/310G0i423B0b Have you ever met this issue ?

jkuri commented 6 years ago

hi @DuongHieuMAI! I don't understand what is the issue, can you clarify a bit?

jkuri commented 6 years ago

oh sorry, I see the lines in the video.. I noticed that before as well. try disconnecting camera from USB and connecting again... it helps usually.

DuongHieuMAI commented 6 years ago

@jkuri Thank you very much for your reply. But unfortunately, it didn't work for me. I'm using Ubuntu 16.04.4 LTS. Maybe your solution works on MacOS only or other Ubuntu version.

berli commented 6 years ago

@jkuri I have the same problem when using usb camera and open mp4 files

jkuri commented 6 years ago

sorry but I am on vacations now. make sure you set width and height

berli commented 6 years ago

@jkuri yes, I add the resize in do loop , as following:

        cv::resize(image, image, cv::Size(width, height));         

        const int stride[] = {static_cast<int>(image.step[0])};   

        sws_scale(swsctx, &image.data, stride, 0, image.rows, frame->data, frame->linesize);    

        frame->pts += av_rescale_q(1, out_codec_ctx->time_base, out_stream->time_base);   

        write_frame(out_codec_ctx, ofmt_ctx, frame);  `

but it also doesn't work yet, I get the the error:

https://github.com/jkuri/opencv-ffmpeg-rtmp-stream/issues/4

pls help, thank you in advance~

jkuri commented 6 years ago

@berli, you don't need to resize frames in code. if you check documentation (readme) carefuly again you'll notice that you can pass parameters for --width and --height from the command line. make sure that your webcam supports dimension you are passing as parameters and it should work.

berli commented 6 years ago

@jkuri oh , thank you for your reply; I found, it will crash https://github.com/jkuri/opencv-ffmpeg-rtmp-stream/issues/4 if I input video by webcam , but it works well if input by reading avi file; so I wonder if it's because there's no pts or dts coming in?