Saving an H.264 RTP stream without re-encoding?

My C ++ application receives an H.264 RTP video stream.

At the moment, it decodes the stream, saves it to a YUV file, and later I use ffmpeg to reuse the file for something suitable for viewing on a Windows PC (for example, Mpeg4 AVI).

Is it possible to save an H.264 stream to an AVI container (or similar) without the need for its decoding and re-encoding? This will require some H.264 decoder on the PC, but it should be much more efficient.

How can I do that? Are there libraries supporting this?

+3
source share
3 answers

rtp ffmpeg - popen3().

, SDP - , , , named pipe tmpfile(), , - .

:

int p[3];
const char* const out_fmt = "avi";
const char* cmd[] = {"ffmpeg","-f",,"-i",temp_sdp_filename,"-vcodec","copy","-f",out_fmt,"-",NULL};
if(-1 == popen3(p,cmd)) ...
// write the rtp that you receive to p[STDIN_FILENO]
// read the avi from p[STDOUT_FILENO]
// read any messages and error text from p[STDERR_FILENO] 

, ffmpeg , (rtp stream vs AVI) ( -vcodec copy); , .

+1

x264. , H264 ( IP-, "- --" ). , MP4, Matroska FLV . : http://www.videolan.org/developers/x264.html

+1

Using ffmpeg is correct, but the answers posted so far are not suitable for me.

The correct switch should be:

-vcodec copy
0
source

Source: https://habr.com/ru/post/1770011/


All Articles