Ask Your Question

jxb's profile - activity

2020-09-16 05:01:42 -0600 received badge  Famous Question (source)
2019-05-24 02:15:24 -0600 received badge  Notable Question (source)
2018-02-26 17:24:12 -0600 received badge  Popular Question (source)
2016-05-20 22:21:48 -0600 received badge  Scholar (source)
2016-05-20 22:21:45 -0600 commented answer How to send opencv video's to ffmpeg

I found out the reason. I changed the pixel format from rgb24 to bgr24 and it worked.

2016-05-20 20:17:53 -0600 commented answer How to send opencv video's to ffmpeg

Thanks. Now am sending to socket and from there reading from ffmpeg. However I have one issue. The color of the video is different. Any ideas?

2016-05-20 03:33:02 -0600 asked a question How to send opencv video's to ffmpeg

I m trying to send the processed opencv Mat as video to ffmpeg. I m encoding the frame and writing it to std output and then piping it to ffmpeg. Here is my code.

C++:

if(!cap.isOpened()) {
    cout << "Video not accessible" << endl;
    return -1;
} else {
    cout << "Video is accessible" << endl;
}

while (true) {

    cap >> frame;

    //some processing

    cv::imencode(".jpg", frame, buff);
    for (i = buff.begin(); i != buff.end(); ++i)
        std::cout << *i ;
}

My input video resolution is 640x418. I do not alter the video size

After building, I use following command to execute.

./a.out | ffmpeg -f rawvideo -pix_fmt bgr24 -s 640x418 -r 30 -i - -an -f mpegts udp://0.0.0.0:8182

and also this

./a.out | ffmpeg -i pipe:0 -f rawvideo -pix_fmt bgr24 -s 640x418 -r 30 -i - -an -f mpegts udp://0.0.0.0:8182

However none of this seems to work.

Kindly help.