Video streaming using ffmpeg with VLC - ffmpeg

I am trying to stream a video called "bbb.mp4" with ffmpeg and visualize it with VLC.
On the OS X Terminal, I do the following:
ffmpeg -re -i bbb.mp4 -an -c:v copy -f mpegts udp://#127.0.0.1:2222
I am video streaming it on the IP address 127.0.0.1 using the port 2222. Once I run this, it shows that it is streaming the video:
But when I visualize it using VLC by going File > Open Network... > Network:
I cannot see anything, even though the code is running in the Terminal:
It does not open. Do you know if I am doing anything wrong?

Try adding packet_size at the end. For example:
ffmpeg -re -i bbb.mp4 -an -c:v copy -f mpegts udp://127.0.0.1:2222?pkt_size=1316
And of course, at VLC:
udp://127.0.0.1:2222?pkt_size=1316

Related

FFmpeg - capture a rtsp stream and re-stream it to another rtsp-server

I want to capture a Rtsp-stream from a Live-CAM which I then want to re-stream to another Rtsp-server.
Basically, my computer will work as a relay-server using FFMpeg.
I have tried this temporary command but I cannot get it working i.e.
ffmpeg.exe -i rtsp://InputIPAddress:554/mystream -preset medium -vcodec libx264 -tune zerolatency -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mysecondstream
I have then tried, for testing purposes, using FFplay to watch the stream from localhost as follows:
ffplay rtsp://localhost:8554/mysecondstream
but no luck.
Anyone who can help me out? Thanks.
Well, I found that this one works:
ffmpeg -rtsp_transport tcp -i "rtsp://123.123.123.123:554/mystream1" -rtsp_transport tcp -c:v copy -f rtsp rtsp://234.234.234.234:554/mystream2
Works even on an Android phone where I have FFmeg running.
However, I am not really pleased with it. I hope I can improve it further.
EDIT: adding "-use_wallclock_as_timestamps 1" makes the stream stable.

Stream RTSP from ONVIF general camera to Youtube

I have a wifi camera that uses RTSP/ONVIF protocol and after reading FFMPEG docs and some threads at Google I am trying to broadcast the stream to Youtube. So I started a broadcast at youtube and in my computer in ffmpeg I executed this command:
ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://200.193.21.176:6002/onvif1 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://x.rtmp.youtube.com/live2/private_key
The command above looks like it's correct cause it ouputs constantly something like this:
The problem is that at YOUTUBE it still says I am offline. Why?
Try replace first part to: ffmpeg -re -i somefile.mp4, so you will to know, if here any problems with your camera or not.
ffmpeg and VLC very similar and even uses same code for codecs. But RTSP it handles differently. But try just ffmpeg -i rtsp://200.193.21.176:6002/onvif1 and nothing more as source.

FFmpeg copying from udp to rtsp

So I have a (live)video stream on udp://10.5.5.100:8463 and I copy it to udp://localhost:1000.
ffmpeg -f mpegts -i "udp://10.5.5.100:8554?fifo_size=10000" -f mpegts -vcodec copy udp://localhost:1000/go
And it works fine in VLC but Wirecast doesn't accept udp://..., but it accepts rtsp://...
but I don't now much about ffmpeg, so I only changed udp to rtsp
ffmpeg -f mpegts -i "udp://10.5.5.100:8554?fifo_size=10000" -f mpegts -vcodec copy rtsp://localhost:1000/go
But it doesn't work and outputs this
rtsp://localhost:1000/go: Protocol not found
Thank you for answers!!
If you put '-f rtsp' instead of '-f mpegts' ffmpeg will try to establish connection to this url.
Proper solution with ffmpeg suite will be complex and include 'ffserver' as rtsp server and 'ffmpeg' as media stream source for the ffserver.
Much more simpler solution is to try vlc:
cvlc -vvv udp://10.5.5.100:8554?fifo_size=10000 --sout '#rtp{sdp=rtsp://localhost:1000/go}'
It starts RTSP server on localhost:1000 and retransmits data from UDP to the clients connected to this RTSP server.

In libav "rtmp://url live=1" is not working as in FFmpeg

I am trying to play live rtmp stream, streamed via Red5 server.
Command used is ffmpeg -i "rtmp://IP/live/1234 live=1" -f flv rtmp://IP/live/1234_56
The above command for live streaming works well with ffmpeg on Window OS. But unable to stream live rtmp video below command is run on libav ,Ubuntu OS using avconv tool.
avconv -i "rtmp://IP/live/1234 live=1" -f flv rtmp://IP/live/1234_56
Even i used *rtmp_live* AVOption to play live stream or to replace live=1 parameter as given below-
avconv -i "rtmp://IP/live/1234 rtmp_live" -f flv rtmp://IP/live/1234_56
But this command doesn't work. Please tell me how to use rtmp_live or live=1 with avconv tool
Thanks in advance.
Have you tried
ffmpeg -i "rtmp://IP/live/1234?live=1" -f flv rtmp://IP/live/1234_56

Can ffmpeg process rtmp stream from FMS at all?

ffmpeg -i rtmp:/vid2/recordings -acodec copy -vcodec copy -y captured.flv
or
ffmpeg -i rtmp://localhost/vid2/recordings -acodec copy -vcodec copy -y captured.flv
The above command only give me this error:
rtmp://localhost/vid2/recordings: no such file or directory
Isn't ffmpeg supposed to be able to handle rtmp streams?
Are you using the Xuggler version of ffmpeg? Here's a tutorial explaining how to obtain and encode rtmp streams with the Xuggler ffmpeg.
http://wiki.xuggle.com/Live_Encoding_Tutorial
No need to use Xuggler's build. Version .6 of ffmpeg does support rtmp. However, make sure you compile with
--enable-librtmp
ffmpeg can catch the stream of rtmp. Try it with entering port like 1935
ffmpeg -i rtmp://localhost:1935/live/newStream
But before doing that check if newStream exist. If not, open new cmd and enter ffmpeg/bin folder
ffmpeg -i sample.avi -f flv rtmp://localhost/live/newStream
Then try to run first code.
appears it can (analyzeduration to get rid of an initial delay)
$ ffplay -analyzeduration 0 -i "rtmp://localhost/live/stream_name live=1"
See http://betterlogic.com/roger/2012/08/ffmpeg-receiving-rtmp-stream-from-flash-media-server/ for some instructions on how to stream to it, as well.
I have same problem with FFMPEG.
I publish video from FFMPEG on FMS correctly and I can see that on the FMS video player.
ffmpeg -re -i /home/videos/sample.mp4 -f flv rtmp://localhost/live/sample
Now I would like to create live stream.
For this case I use this code in the FFMPEG on linux:
ffmpeg -re -i rtmp://localhost:1935/live/sample -vcodec copy -acodec copy -f flv rtmp://localhost/livepkgr/sample_streamd?adbe-live-event=sample_event
By use this syntax I get same error:
Closing connection: NetStream.Play.StreamNotFound
rtmp://localhost:1935/live/sample: Operation not permitt

Resources