FFMPEG:将MP4多路复用数据重定向到套接字 [英] FFMPEG : Redirecting MP4 muxed data to socket

查看:279
本文介绍了FFMPEG:将MP4多路复用数据重定向到套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FFMPEG库将H.264和AAC帧复用到MP4文件.我可以使用命令行和C程序来做到这一点.

I am using FFMPEG library to mux H.264 and AAC frames to MP4 file. I can do that both using command line and C program.

现在,我不想将多路复用的MP4数据写入文件中,而是想将这些多路复用的数据直接写入套接字或管道中.命令行选项将不胜感激.我的实际目标是写一个C程序.

Now, instead of writing the muxed MP4 data in to file I want to write these muxed data directly on to socket or pipe. Command line options for that will be appreciated. My actual goal is to write a C program though.

我尝试使用协议tcp和udp,但它们不适用于Mp4格式.他们正在使用matroska格式.

I tried using protocols tcp and udp but they are not working with Mp4 format. They are working with the matroska format.

关注正在工作.

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

以下不是,并且会出现以下错误.

Following is not and gives error as 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.

推荐答案

只有一种方法可以使用片段直接在套接字上输出多路复用的MP4输出.我知道使用片段有局限性,但这很有用.

Just got one way to output the muxed MP4 output directly on the socket using fragments. I know there are limitations of using fragments but this can be useful.

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

所以下面的命令行现在对我有用.我可以播放从8888端口接收到的MP4文件. ffprobe还确认它确实是MP4文件.

So following command line is working for me now. I am able to play the MP4 file received from the 8888 port. ffprobe also confirms that its really an MP4 file.

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

现在,我将不得不编写C程序来实际地执行此操作.

Now I will have to write the C program to do this pragmatically.

这篇关于FFMPEG:将MP4多路复用数据重定向到套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆