Ask Your Question

AssemblerX86's profile - activity

2019-10-07 15:25:12 -0600 received badge  Notable Question (source)
2019-10-01 22:46:36 -0600 received badge  Famous Question (source)
2019-02-12 10:59:06 -0600 received badge  Famous Question (source)
2018-11-13 18:42:02 -0600 received badge  Popular Question (source)
2018-08-21 00:15:52 -0600 received badge  Notable Question (source)
2018-04-20 12:31:19 -0600 received badge  Notable Question (source)
2017-12-09 19:04:03 -0600 received badge  Popular Question (source)
2017-11-12 21:31:19 -0600 received badge  Popular Question (source)
2016-10-18 12:49:34 -0600 commented answer VideoWriter not writing frames to H264 output file

"changed cv::Size(het, wid) to cv::Size(wid,het). It could be a problem" <- that solved it

2016-10-15 13:27:10 -0600 commented answer VideoWriter not writing frames to H264 output file

For OpenCV 3.1 its still 1.4.0, and I doubt the version has to do with this problem.

2016-10-14 16:29:04 -0600 asked a question VideoWriter not writing frames to H264 output file

I am VideoWriter to write frames which are read from VideoCapture. The H264 file has the header and tail information written, but no frames are written in the file, the file is just 1KB large.

I am using OpenCV 3.1, and I have put openh264 1.4 dll file in the same path.

Here is my code:

#include <iostream>
#include <stdio.h>
#include "stdafx.h"
#include "opencv2/opencv.hpp"
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"

using namespace std;
using namespace cv;

int main()
{
Mat testFrame;

VideoCapture vidReader("vid.mp4");

//vidReader.read(testFrame);

unsigned int frameCount = vidReader.get(CV_CAP_PROP_FRAME_COUNT);
double FPS = vidReader.get(CV_CAP_PROP_FPS);
int format = vidReader.get(CV_CAP_PROP_FOURCC);
int wid = vidReader.get(CV_CAP_PROP_FRAME_WIDTH);
int het = vidReader.get(CV_CAP_PROP_FRAME_HEIGHT);
//int fcount = vidReader.get(CV_CAP_PROP_FRAME_COUNT);

VideoWriter vidWriter;
vidWriter.open("vid2.mp4", CV_FOURCC('H', '2', '6', '4'), FPS, cv::Size(het, wid), true);

//for(int i = 0; i < 120; i++) vidWriter.write(injectFrame);
if (!vidWriter.isOpened())
{
    printf("\nFailed to open\n");
    return 1;
}


int ct = 0;
while (1)
{

    printf("Frame: %d\n", ct);
    Mat nxtFrame;
    if (!vidReader.read(nxtFrame))
    {
        printf("Couldn't read next frame\n");
        break;
    }
    else printf("grabbed frame\n");

    vidWriter.write(nxtFrame);
    ct++;
}

//printf("Frames: %d\n", fcount);
vidWriter.release();
}

Thanks in advance.

2016-10-12 22:16:24 -0600 commented answer How to encode a H264 video on Windows?

Yes, I have tried adding the path to the three Environment Variables mentioned in that issue.

2016-10-12 12:42:51 -0600 commented answer How to encode a H264 video on Windows?

After I have done a "make clean" and "make" and relinked libraries, I am getting the same "Could not find encoder for codec id 28: Encoder not found" error again, any idea why?

2016-10-12 05:53:06 -0600 commented answer How to encode a H264 video on Windows?

It worked thanks :) But just a note that the latest supported OpenH264 is 1.5.0 and not 1.6.0.

2016-10-12 05:52:14 -0600 received badge  Supporter (source)
2016-10-12 05:52:11 -0600 received badge  Scholar (source)
2016-10-11 16:53:01 -0600 received badge  Editor (source)
2016-10-11 16:52:30 -0600 asked a question How to encode a H264 video on Windows?

Hi,

I am trying to encode a video using X264 encoder, but I keep getting "Could not find encoder for codec id 28: Encoder not found" error.

I have tried CV_FOURCC('X', '2', '6', '4'), CV_FOURCC('H', '2', '6', '4') and CV_FOURCC('A', 'V', 'C', '1') all didn't work.

Tried to install VFW, didn't work too. I have "opencv_ffmpeg2413.dll" included in the same directory (Tried removing it after installing VFW.)

I am building using VC12.

2016-08-31 10:43:31 -0600 asked a question Does OpenCV capture/write audio to video??

Hi,

I was trying to capture frames from one video and write them to a new video file using VideoCapture and VideoWriter, I could get AVI and MP4 videos after trying different FOURCC such as "XVID", "FMP4", "MP4V" (For MP4) and "IYUV" (AVI). The problem is that the video I get has no audio, just video, so is OpenCV just for image related operations (No audio involved)? What is the purpose of VideoWriter if you were going to create a video with no audio (80% of videos have audio... If not more)?

Thanks in advance!