简体   繁体   English

如何通过gstreamer将pcap转换为带有视频和音频的avi文件?

[英]How to convert pcap to avi file with video and audio by gstreamer?

I need to read a pcap file and convert it into a avi file with audio and video by using gstreamer. 我需要读取一个pcap文件,并使用gstreamer将其转换为带有音频和视频的avi文件。

If i try the following command, it only works for generating a video file. 如果我尝试以下命令,则仅适用于生成视频文件。

Video Only 仅视频

gst-launch-0.10 -m -v filesrc location=h264Audio.pcap ! gst-launch-0.10 -m -v filesrc位置= h264Audio.pcap! pcapparse src-port=44602 \\ !"application/x-rtp, payload=96" ! pcapparse src-port = 44602 \\!“应用程序/ x-rtp,有效载荷= 96”! rtph264depay ! rtph264depay! "video/x-h264, width=352, height=288, framerate=(fraction)30/1" \\ ! “视频/ x-h264,宽度= 352,高度= 288,帧频=(分数)30/1” \\! ffdec_h264 ! ffdec_h264! videorate ! 视频率! ffmpegcolorspace \\ ! ffmpegcolorspace \\! avimux ! avimux! filesink location=testh264.avi filesink位置= testh264.avi

Audio Only 仅音频

And if i use the following command, it only works for generating a audio file. 如果我使用以下命令,则它仅适用于生成音频文件。

gst-launch-0.10 -m -v filesrc location=h264Audio.pcap ! gst-launch-0.10 -m -v filesrc位置= h264Audio.pcap! pcapparse src-port=7892 \\ ! pcapparse src-port = 7892 \\! "application/x-rtp, payload=8" ! “ application / x-rtp,有效负载= 8”! rtppcmadepay ! rtppcmadepay! alawdec ! alawdec! audioconvert ! 音频转换! audioresample ! audioresample! avimux ! avimux! filesink location=test1audio.avi filesink位置= test1audio.avi

Video + Audio 视频+音频

When i combine two commands as follows, i encountered an error message -- ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc1: Internal data flow error. 当我如下组合两个命令时,我遇到一条错误消息-错误:来自元素/ GstPipeline:pipeline0 / GstFileSrc:filesrc1:内部数据流错误。

gst-launch-0.10 -m -v filesrc location=h264Audio.pcap ! gst-launch-0.10 -m -v filesrc位置= h264Audio.pcap! pcapparse src-port=44602 \\ !"application/x-rtp, payload=96" ! pcapparse src-port = 44602 \\!“应用程序/ x-rtp,有效载荷= 96”! rtph264depay ! rtph264depay! "video/x-h264, width=352, height=288, framerate=(fraction)30/1" \\ ! “视频/ x-h264,宽度= 352,高度= 288,帧频=(分数)30/1” \\! ffdec_h264 ! ffdec_h264! videorate ! 视频率! ffmpegcolorspace \\ ! ffmpegcolorspace \\! queue ! 排队! mux. 多路复用器。 \\ filesrc location=h264Audio.pcap pcapparse src-port=7892 \\ ! \\ filesrc位置= h264Audio.pcap pcapparse src端口= 7892 "application/x-rtp, payload=8" ! “ application / x-rtp,有效负载= 8”! rtppcmadepay ! rtppcmadepay! alawdec ! alawdec! audioconvert ! 音频转换! audioresample ! audioresample! queue ! 排队! avimux name=mux ! avimux名称= mux! filesink location=testVideoAudio.avi filesink location = testVideoAudio.avi

Please kindly give me some solutions or suggestions with regard to this issue. 请给我一些有关此问题的解决方案或建议。 Thank you in advance. 先感谢您。 Eric 埃里克

代替第二个“ filesrc!pcapparse”,给第一个pcapparse一个名称= demux,删除src-port arg并从demux开始第二个分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM