Ask Your Question

Revision history [back]

Can I save H.264/5 data to MP4 without transcoding?

I would like to use OpenCV's VideoCapture/VideoWriter to write video stream data (H.264/5) to an MP4 file without encoding/decoding. I can do this with ffmpeg like so:

$ ffmpeg -i <rtsp_url> -vcodec copy -y -rtsp_transport tcp <output_mp4>

How would I do the equivalent using OpenCV? There doesn't seem to be a "Four CC" option for "straight copy without transcoding".

BTW this has also come up for another user on StackOverflow with almost the same use case as mine.

Thanks in advance for any comments or suggestions, I appreciate your help.