windows 如何从 FFMPEG 生成 SDP 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9914437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to generate SDP file from FFMPEG
提问by MobilityLab
So, I have been working with FFMPEG on a project that involves streaming video from one computer to another across the internet with RTP. I want to take that into ffmpeg and use ffserver to display it on a local network.
因此,我一直在与 FFMPEG 合作开展一个项目,该项目涉及使用 RTP 通过 Internet 将视频从一台计算机流式传输到另一台计算机。我想把它带入 ffmpeg 并使用 ffserver 在本地网络上显示它。
As I understand it, you need to have a SDP information so that the receiving ffmpeg instance can interpret the RTP stream. Despite what webpages say, I can not find the SDP information in the information printed to the console.
据我了解,您需要有一个 SDP 信息,以便接收 ffmpeg 实例可以解释 RTP 流。不管网页怎么说,我在打印到控制台的信息中找不到SDP信息。
How can I force the transmitting ffmpeg instance to output the SDP information so that I can use it to configure my receiving end?
如何强制发送 ffmpeg 实例输出 SDP 信息,以便我可以使用它来配置我的接收端?
Right now, I am testing on Windows 7, but the final solution will be on linux.
现在,我正在 Windows 7 上进行测试,但最终的解决方案将在 linux 上进行。
The command I'm running for testing is
我正在运行的测试命令是
ffmpeg -fflags +genpts -i files05-SFSD-sample-mpeg1.mpg -threads 0 -r 10 -g 45
-s 352x240 -deinterlace -y 2005.mp4 -an -threads 0 -r 10 -g 45 -s 352x240
-deinterlace -f rtp rtp://192.168.200.198:9008
My ffmpeg information is...
我的ffmpeg信息是...
ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 14:22:23 with gcc 4.5.3
configuration:
--disable-static
--enable-shared
--enable-gpl
--enable-version3
--enable-memalign-hack
--enable-runtime-cpudetect
--enable-avisynth
--enable-bzlib
--enable-frei0r
--enable-libopencore-amrnb
--enable-libopencore-amrwb
--enable-libfreetype
--enable-libgsm
--enable-libmp3lame
--enable-libopenjpeg
--enable-librtmp
--enable-libschroedinger
--enable-libspeex
--enable-libtheora
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libxavs
--enable-libxvid
--enable-zlib
--disable-outdev=sdl
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
回答by Camille Goudeseune
https://stackoverflow.com/a/16469378/2097284explains in more detail how to make the .sdp
file, and how to pass that to ffplay
.
https://stackoverflow.com/a/16469378/2097284更详细地解释了如何制作.sdp
文件,以及如何将其传递给ffplay
.
回答by David Andreoletti
FFMPG generates a SDP file when specified with -sdp_file path/to/file
FFMPG 在指定时生成 SDP 文件 -sdp_file path/to/file
Documentation excerpt:
文档摘录:
-sdp_file file (global)
Print sdp information for an output stream to file. This allows
dumping sdp information when at least one output isn't an rtp stream.
(Requires at least one of the output formats to be rtp).
-sdp_file file (global)
Print sdp information for an output stream to file. This allows
dumping sdp information when at least one output isn't an rtp stream.
(Requires at least one of the output formats to be rtp).
回答by Victor.dMdB
Just in case anyone was looking to find how to do this with ffmpeg C code, you can use av_sdp_create
to generate an sdp string
以防万一有人想找到如何使用 ffmpeg C 代码执行此操作,您可以使用它av_sdp_create
来生成 sdp 字符串
回答by code7amza
Normally when the output is one rtp stream, ffmpeg prints the sdp information in the console so you just have to redirect it (and then use the sdp ):
通常当输出是一个 rtp 流时,ffmpeg 会在控制台中打印 sdp 信息,因此您只需重定向它(然后使用 sdp ):
ffmpeg -fflags +genpts -i files05-SFSD-sample-mpeg1.mpg -an -threads 0 -r 10 -g 45 -s 352x240 -deinterlace -f rtp rtp://192.168.200.198:9008 > config.sdp
But from your command it looks like you want to do one encoding for two outputs ... if the two outputs are rtp (helpful for video + audio) it works fine , but I couldnt get it to print the sdp when 1 output is rtp and the other mp4 ... not sure if possible
但是从您的命令来看,您似乎想对两个输出进行一种编码...如果两个输出是 rtp(对视频 + 音频有帮助),则它工作正常,但是当 1 个输出是 rtp 时,我无法让它打印 sdp和另一个 mp4 ......不确定是否可能
Anyway what you can do though is to generate the sdp file for the first time, and as long as you dont change the video characteristics (resolution format ...) or the rtp address this sdp file will be valid, and your previous command would work with it !!
无论如何,您可以做的是第一次生成 sdp 文件,只要您不更改视频特性(分辨率格式...)或 rtp 地址,此 sdp 文件将有效,您之前的命令将使用它!!
hope this helps
希望这可以帮助