Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

convert an RTP/UDP stream to HTTP

Discussions about problems encountered using ffserver.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

convert an RTP/UDP stream to HTTP

Postby inversus » Mon Jul 11, 2011 8:50 am

Hi all,

As you may know, android uses a strange implementation of RTP - It can only play low bitrate RTP streams. On the other hand, it can play Full HD HTTP stream flawlessly.
I'm trying a workaround for this problem: As stated in the title, using ffmpeg to convert the RTP/UDP stream to HTTP.

I've already compile ffmpeg for android, but I'm having difficulties configuring the "ffserver.conf".
1) Is it possible to achieve what I want with ffmpeg?
2) I dont need any transcoding, will it use lots of the processor/memory?
3) Can you help me with these configurations? :)

I receive a udp/rtp multicast stream:
. udp://@239.192.1.31:1234 or rtp://@239.192.1.31:1234 - TV channels
I want to output to HTTP:
. http://127.0.0.1:8090/stream.mp4

Thank you in advance :!:
inversus
 
Posts: 1
Joined: Mon Jul 11, 2011 8:35 am

Re: convert an RTP/UDP stream to HTTP

Postby admin » Thu Sep 08, 2011 10:55 am

I receive a udp/rtp multicast stream:
. udp://@239.192.1.31:1234 or rtp://@239.192.1.31:1234 - TV channels
I want to output to HTTP:
. http://127.0.0.1:8090/stream.mp4


This would be enough:
ffmpeg -i udp://@239.192.1.31:1234 -acodec copy -vcodec copy http://localhost:8090/feed1.ffm

And the ffserver.conf file would be something like this:
Code: Select all
Port 8090
BindAddress 0.0.0.0
MaxClients 10
MaxBandwidth 40000
NoDaemon

<Feed feed1.ffm>
   File /tmp/feed1.ffm
   FileMaxSize 5M
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
</Feed>

<Stream stream.mp4>
   Feed feed1.ffm
   Format mp4

   VideoCodec libx264
   VideoFrameRate 25
   # VideoBufferSize 40
   VideoBitRate 512K
   VideoSize 640x480
   # VideoGopSize 15
   # StartSendOnKey

   # NoAudio

   # i had problems with videostreaming with file. player said that header were corrupted, so i used this config, but it doesnt help. i still let it in.
   AVOptionVideo flags +global_header

   # ffpreset-fast (i think you can remove this in latest ffmpeg)
   AVOptionVideo coder 1
   AVOptionVideo flags +loop
   AVOptionVideo cmp +chroma
   AVOptionVideo partitions +parti8x8+parti4x4+partp8x8+partb8x8
   AVOptionVideo me_method hex
   AVOptionVideo subq 6
   AVOptionVideo me_range 16
   AVOptionVideo g 250
   AVOptionVideo keyint_min 25
   AVOptionVideo sc_threshold 40
   AVOptionVideo i_qfactor 0.71
   AVOptionVideo b_strategy 1
   AVOptionVideo qcomp 0.6
   AVOptionVideo qmin 10
   AVOptionVideo qmax 51
   AVOptionVideo qdiff 4
   AVOptionVideo bf 3
   AVOptionVideo refs 2
   AVOptionVideo directpred 1
   AVOptionVideo trellis 1
   AVOptionVideo flags2 +bpyramid+mixed_refs+wpred+dct8x8+fastpskip
   AVOptionVideo wpredp 2
   AVOptionVideo rc_lookahead 30

</Stream>

<Stream stat.html>
   Format status
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
</Stream>

<Redirect index.html>
   URL http://www.ffmpeg.org/
</Redirect>
admin
Site Admin
 
Posts: 26
Joined: Thu May 05, 2011 4:24 pm

convert rtp_stream to flv_stream

Postby apolychrono » Thu Nov 10, 2011 2:35 pm

I use the following command to produce an rtp-stream.
Code: Select all
 0) ffmpeg  -re -s 352x288 -f rawvideo -pix_fmt yuv420p  -r 10 -i sample_352x288@10_YUV420p.yuv -an  -vcodec libx264  -preset fast -profile baseline -threads 0 -r 10 -s 352x288 -b:v 200k -flags global_header  -f rtp rtp://127.0.0.1:9999 ;


Then i try the following:
Code: Select all
  1) ffmpeg -i stream.sdp  -vcodec copy http://127.0.0.1:8090/feed1.ffm
The stream.sdp contains the SDP output from the first (0) ffmpeg-command .

Code: Select all
  2) ffserver -d -f ffserver.conf


and my ffserver.conf is:


Code: Select all
Port 8090
BindAddress 0.0.0.0
MaxClients 10
MaxBandwidth 40000
NoDaemon

<Feed feed1.ffm>
   File /tmp/feed1.ffm
   FileMaxSize 15M
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
   ACL allow 10.8.13.202 10.8.13.255
</Feed>

<Stream video1.flv>
    Feed feed1.ffm
    Format flv
    AVOptionVideo flags +global_header
#    AVOptionAudio flags +global_header
#    AudioCodec libmp3lame
#    AudioBitRate 32
#    AudioChannels 1
#    AudioSampleRate 11025
    VideoCodec libx264
    VideoSize 720x576
    VideoBitRate 1500K
    VideoFrameRate 25
    AVOptionVideo threads 4
    AVOptionVideo qmin 10
    AVOptionVideo qmax 51
    AVOptionVideo qdiff 4
    AVOptionVideo g 250
    AVOptionVideo keyint_min 25
    AVOptionVideo sc_threshold 40
    AVOptionVideo coder 0
    AVOptionVideo bf 0
    AVOptionVideo b_strategy 1
    AVOptionVideo refs 1
    AVOptionVideo flags +loop
    AVOptionVideo flags2 -bpyramid-wpred-dct8x8+mixed_refs+fastpskip
    AVOptionVideo i_qfactor 0.71
    AVOptionVideo qcomp 0.6
    AVOptionVideo partitions -parti8x8-partp4x4+parti4x4+partp8x8+partb8x8
    AVOptionVideo me_method hex
    AVOptionVideo me_range 16
    AVOptionVideo subq 6
    AVOptionVideo trellis 0
    AVOptionVideo wpredp 0
    VideoGopSize 50
    Preroll 4
    StartSendOnKey
</Stream>


Finally the output of (1) is:


Code: Select all
ffmpeg version N-34329-g26b6455, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov  7 2011 10:38:35 with gcc 4.4.3
  configuration: --enable-static --enable-gpl --enable-nonfree --enable-postproc --enable-libfaac --enable-libx264
  libavutil    51. 22. 0 / 51. 22. 0
  libavcodec   53. 26. 0 / 53. 26. 0
  libavformat  53. 18. 0 / 53. 18. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 45. 3 /  2. 45. 3
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[sdp @ 0x32e0760] Estimating duration from bitrate, this may be inaccurate
Input #0, sdp, from '352x288@10_preset_fast.sdp':                                                                                                                                                                                                                             
  Metadata:
    title           : No Name
  Duration: N/A, start: -3.309000, bitrate: N/A
    Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 352x288, 10 fps, 10 tbr, 90k tbn, 20 tbc
[mp2 @ 0x32deca0] codec type or id mismatches
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':                                                                                                                                                                                                                         
  Metadata:
    title           : No Name
    Stream #0:0: Audio: adpcm_swf, 22050 Hz, 1 channels, s16, 88 kb/s
    Stream #0:1: Video: h264, yuv420p, 352x288, q=10-51, 1000k tbn, 10 tbc
Stream mapping:
  Stream #0.0 -> #0.0Segmentation fault


I posted it here beacause i think i have the same problem. I have also tried with different ffserver,conf files to covert it to http stream or rtsp stream but i keep getting the same errors.

thanks in advance.
apolychrono
 
Posts: 4
Joined: Mon Jun 27, 2011 1:17 pm

Re: convert an RTP/UDP stream to HTTP

Postby admin » Thu Nov 10, 2011 6:19 pm

you could report that segfault, using gdb (explained here http://ffmpeg.org/bugreports.html ), to the bug tracker here: https://ffmpeg.org/trac/ffmpeg
admin
Site Admin
 
Posts: 26
Joined: Thu May 05, 2011 4:24 pm

Re: convert an RTP/UDP stream to HTTP

Postby scsmith » Sun Mar 09, 2014 11:43 pm

This would be enough:
ffmpeg -i udp ://@239.192.1.31:1234 -acodec copy -vcodec copy http ://localhost:8090/feed1.ffm

This, along with your ffserver.conf file works great - thank you for that!!!

I'm TRYING to resize the video on my udp stream - it comes in at 1920X1080, and no matter what I do I get errors.
I've figured out enough ffmpeg to get it to convert the stream to a file the way I want, but I can't get it to go to the feed1.ffm without errors.

I am using
Code: Select all
ffmpeg -i 'udp://@10.0.1.6:1234?fifo_size=1000000&buffer_size=10000000&overrun_nonfatal=1' -c:v libx264 -s 640x360 -crf 20 -maxrate 400k -bufsize 1835k output.mp4

Which works great, but if I change the output to http ://localhost:8090/feed1.ffm I get "Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height"

Any help is appreciated!

P.S. I realize I have an extra space in the http and udp urls, the forum won't let me post a proper url because I'm new! :)
scsmith
 
Posts: 2
Joined: Sun Mar 09, 2014 11:18 pm

Re: convert an RTP/UDP stream to HTTP

Postby scsmith » Mon Mar 10, 2014 12:22 pm

Please disregard my previous post. I spent several hours on this before posting without success, but the following thread solved my issues. Now I just need to learn why ;)

viewtopic.php?f=12&t=1206
scsmith
 
Posts: 2
Joined: Sun Mar 09, 2014 11:18 pm

Re: convert an RTP/UDP stream to HTTP

Postby imrankhan01225 » Fri Nov 04, 2016 9:13 am

Hey I am new here and i don't have idea to transcoding.

i have rtp://10.0.150.3/live/livestream and how can i get http://10.0.150.3/live/livestream

please help me send me step to step tutorial
imrankhan01225
 
Posts: 1
Joined: Fri Nov 04, 2016 8:53 am


Return to ffserver

Who is online

Users browsing this forum: No registered users and 3 guests