FFMPEG: Forward multiplexed MP4 data to socket

I am using FFMPEG library for H.264 and AAC multiplexers in MP4 file. I can do this both from the command line and from a C program.

Now, instead of writing the multiplexed MP4 data to a file, I want to write this multiplexed data directly to a socket or pipe. Command line options for this would be appreciated. My actual goal is to write a C program though.

I tried to use tcp and udp protocols but they don't work with Mp4 format. They work with matroska format.

Works.

ffmpeg -i Cartoon.mjpeg -f matroska -r 25 -vcodec copy tcp://10.99.19.224:8888

      

Below is inaccurate and given below.

ffmpeg -i Cartoon.mjpeg -f mp4 -r 25 -vcodec copy tcp://10.99.19.224:8888

Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted

      

Any help or advice? Thank you in advance.

+3


source to share


2 answers


Only one way to output multiplexed MP4 output directly to socket using chunks. I know there are limitations to using snippets, but it might be helpful.

https://www.ffmpeg.org/ffmpeg-formats.html#Example-1

So now the following command line works for me. I can play the MP4 file received from port 8888. ffprobe also confirms that it is indeed an MP4 file.



ffmpeg -i Stingray.264 -f mp4 -movflags isml+frag_keyframe -vcodec copy tcp://10.99.19.224:8888

      

Now I will need to write a C program to do this pragmatically.

+5


source


If you look at the entire ffmpeg output, the line appears:

[mp4 @ 0033d660] muxer does not support output that cannot be found



The mp4 container must return at the beginning of the file to record additional information. What your network socket cannot do. So you can't use the mp4 container here.

+2


source







All Articles