MobilityLab
MobilityLab

Reputation: 101

How to generate SDP file from FFMPEG

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.

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.

How can I force the transmitting ffmpeg instance to output the SDP information so that I can use it to configure my receiving end?

Right now, I am testing on Windows 7, but the final solution will be on linux.

The command I'm running for testing is

ffmpeg -fflags +genpts -i files\2005-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 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 

Upvotes: 10

Views: 37488

Answers (4)

David Andreoletti
David Andreoletti

Reputation: 4861

FFMPG generates a SDP file when specified with -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).

Upvotes: 4

Victor.dMdB
Victor.dMdB

Reputation: 1019

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

Upvotes: 4

Camille Goudeseune
Camille Goudeseune

Reputation: 3162

https://stackoverflow.com/a/16469378/2097284 explains in more detail how to make the .sdp file, and how to pass that to ffplay.

Upvotes: 5

code7amza
code7amza

Reputation: 181

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 ):

ffmpeg -fflags +genpts -i files\2005-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

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 !!

hope this helps

Upvotes: 2

Related Questions