FFMPEG: rtsp stream to a udp stream - ffmpeg

I am looking for advice on using ffmpeg to convert RTSP stream to udp stream. What would be the simplest general command to do so? This is what I have right now:
ffmpeg -i rtsp://192.168.1.247/play1.sdp -f mpegts -vcodec mpeg4 -acodec mp2 udp://127.0.0.1:1234
The error I'm getting:
UDP timeout, retrying TCP
method PAUSE failed: 405 PAUSE
rtsp://192....: operation not permitted
Finishing stream 0:0 without any data written to it.
I'm running ubuntu 14.04. Thank you!

Looks like the ffmpeg command you are using good enough. I suspect your RTSP input stream is not valid. Have you verified it? You can do so using below command or in vlc also:
ffplay -i rtsp://192.168.1.247:port/filename
One change in the command could be instead of play1.sdp, you can directly give the stream filename i.e, a playable stream than sdp file. Hope it helps.

Related

ffmpeg conversion stops suddenly

I am using FFmpeg converter to push the RTSP stream to RTMP endpoint (Wowza).
ffmpeg -i rtsp://127.0.0.1:554/live0 -c copy -f flv rtmp://88.888.888.888:1935/live/test
The command first throws below error and proceeds with the conversion.
I can play the stream from RTMP endpoint, but after a few seconds, FFmpeg stucks and RTMP endpoint stops to stream.
Please Let me know if I am missing anything here.
I am open to use other libraries for pushing RTSP to RTMP endpoint
You can add analyzeduration and probesize options.
ffmpeg -analyzeduration 10M -probesize 10M -i rtsp://127.0.0.1:554/live0 -c copy -f flv rtmp://88.888.888.888:1935/live/test
If it failed again, you can try increasing the analyzeduration and probesize options to 20M and 40M.
If still failed, please post the total console log output.

FFMPEG RTSP streaming

I need help with ffmpeg streaming. I have a Grandstream GSC3510 Speaker that it also works like a telephone. I need to configure a rtsp server for streaming 1 file or mutiple files (if possible) of music. I tried straming with UDP that worked but only RSTP format can be streamed and if a call comes in, interupted while call is in place and then continued when the call is over.
my code for udp worked fine:
ffmpeg -stream_loop -1 -re -i C:\relax.mp3 -vol 30 -filter_complex aresample=16000,asetnsamples=n=160 -acodec g722 -ac 1 -vn -f rtp udp://239.255.255.241:5555
but I cant get RTSP to work Im kind of a new at this so I would really appreciate some help.
Please try the live555 RTSP streaming server to stream the data to grand stream speaker.

Seek and pause video stream from ffserver

I managed to successfully feed ffserver from ffmpeg. ffmpeg takes input as PIPE:
ffmpeg -loglevel fatal -f image2pipe -re -vcodec png -i - -vcodec libx264 http://localhost:8090/%s.ffm
External java process generates svg/png images and pushes to ffpmepg
My ffserver config allows me to buffer live feeds in ffm file without defining the size of the file.
My stream configuration looks like this:
<Stream live2.mjpg>
Feed feed2.ffm
Format mpjpeg
VideoFrameRate 25
VideoSize 640x880
VideoQMin 1
VideoQMax 5
NoAudio
Strict -1
</Stream>
The problem is that, despite that I can watch streams in VLC by opening network:
http://0.0.0.0:8090/live2.mjpg
But I can not seek through already buffered movie.
Is there a way to achieve seeking through movie, pausing, and resume playing from "now"? I have tried already rtsp with h264, mpg and sdp but without success:
<Stream test1.mpg/sdp/h264>
Format rtp
Feed feed2.ffm
VideoCodec libx264
VideoSize 640x880
VideoQMin 1
VideoQMax 5
NoAudio
Strict -1
VideoFrameRate 25
</Stream>
Is rtsp solution for this problem, or I need something else?
Can this be achieved from dynamic file since I am using PIPE?
RTSP
RTSP support in ffserver seems a bit sketchy, you could try Darwin Streaming Server or the Live555 media server. The two seem to support some forms of trick-play at least for VOD. Since you're using a pipe this won't probably help.
RTMP
Some RTMP servers/clients support in-buffer seeking (Smart Seeking).
About Smart Seek
Adobe Media Server 3.5.3 and Flash Player 10.1 work together to
support smart seeking in VOD streams and in live streams that have a
buffer. [Source].
ffserver doesn't support RTMP output but you can use your ffmpeg command to push your stream directly to the server:
ffmpeg -re -i <input> -f flv rtmp://...
There's a Nginx RTMP module and a C++ RTMP server although it's not very clear if they support smart seeking. VLC seems to be able to seek a bit while paused and there are usually options to modify the size of the client RTMP buffer.

FFMPEG : Redirecting MP4 muxed data to socket

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.
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.
I tried using protocols tcp and udp but they are not working with Mp4 format. They are working with the matroska format.
Following is working.
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.
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#Example-1
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
Now I will have to write the C program to do this pragmatically.
If you look at all the ffmpeg output, there is a line:
[mp4 # 0033d660] muxer does not support non seekable output
The mp4 container needs to go back at the beggining of the file to write additional information. A thing that your network socket can not do. So it is not possible to use mp4 container here.

Wowza error :Failed to play myStream; stream not found.

i am using ffmpeg for encoding a video which will then be restreamed using wowza.i am new to streaming.first i started wowza using command
/etc/init.d/WowzaMediaServer start
after that i start streaming a MP4 file using rtsp protocol.i used the command
ffmpeg -re -i /usr/local/WowzaMediaServer/content/sample.mp4 -acodec libfdk_aac -vcodec libx264 -f rtsp -muxdelay 0.1 rtsp://myuser:mypassword#127.0.0.1:1935/live/myStream.sdp
video start streaming before all of these i changed admin.password and added a username as myuser and password as mypassword when i run above command its streaming but after that they say go to
WowzaMediaServer/examples/LiveVideoStreaming/FlashRTMPPlayer/Player.html
and fill server with rtmp://localhost:1935/live
and Stream field with myStream
when i click on connect its giving me status
"Failed to play myStream; stream not found."
i am following this article http://www.wowza.com/forums/content.php?354-How-to-set-up-live-streaming-using-an-RTSP-RTP-based-encoder
where i am wrong i dont know.i am unable to figure it out. from wowza support team i am not getting satisfactory answers .so someone work on wowza please help me!!why i am not able to connect my video stream to wowza.Please respond stuck badly.
So it appears there are some basic issues with the rtsp from ffmpeg and then no matches to the play request
You have
ffmpeg -re -i /usr/local/WowzaMediaServer/content/sample.mp4 -acodec libfdk_aac -vcodec libx264 -f rtsp -muxdelay 0.1 rtsp://myuser:mypassword#127.0.0.1:1935/live/myStream.sdp
You need to make sure your ffmpeg has libx264 and libfdk_aac plugins available. You should be able to determine this with just
ffmpeg
and it should print out the libraries available.
If you have all the libraries then you are publishing a stream called
myStream.sdp
You then have instructions that say
and fill server with rtmp://localhost:1935/live
and Stream field with myStream
So you should either change your ffmpeg command to
ffmpeg -re -i /usr/local/WowzaMediaServer/content/sample.mp4 -acodec libfdk_aac -vcodec libx264 -f rtsp -muxdelay 0.1 rtsp://myuser:mypassword#127.0.0.1:1935/live/myStream
Note no .sdp in the stream name any more or use a Stream field in the player of
myStream.sdp
When publishing a stream and then attempting to play it back they must match, otherwise you get back Stream Not Found.
One way to successfully do this is to specify only the port number (65000 in this example), making sure it isn't 1935 and server in your ffmpeg command then create a mystream.stream file in your content directory of your Wowza server with ONLY the following line:
udp://0.0.0:65000
Then, in Wowza/conf/startupstreams.xml, add the following:
<!-- Native RTP example (SDP file is myStream.sdp) -->
<StartupStream>
<Application>live/_definst_</Application>
<MediaCasterType>rtp</MediaCasterType>
<StreamName>mystream.stream</StreamName>
</StartupStream>
Restart wowza and ffmpeg and then re-try your url in with the stream name mystream.stream.

Resources