Simple RTMP webcam script? - ajax

Okay I have a rtmp server is there a simple webcam script which I can use to broadcast a webcam to this server I have tried numerous scripts found online however these don't work. I have also asked questions on these scripts I have found online through this forum however haven't had any luck resolving the issues I had with them. Basically I'm after a script which allows a user to broadcast their webcam to an RTMP server. I can provide a rtmp address to test out the script if you can provide one.
Thankyou for any help

If you have FFMPEG installed on your computer...
Here is a quick Windows guide (VFW capture method) :
http://ffmpeg.gusari.org/viewtopic.php?f=25&t=13
If you get a list (first code) with device availble and then it also makes an MP4 test file (second code) then you are ready.
However they recommend using DShow instead of VFW:
see: https://trac.ffmpeg.org/wiki/DirectShow
If you run ffmpeg -list_devices true -f dshow -i dummy in the command prompt you will get a list of devices. One those listed should say "something camera". example output looks like: [dshow # 03ACF580] "Integrated Camera"
Test that "Integrated Camera" with this command:
ffmpeg -f dshow -i video="Integrated Camera" out.mp4
Use a command like this below to send to RTMP server (you must be logged in there too)
ffmpeg -f dshow -i video="Integrated Camera" -acodec aac -ac 2 -strict experimental -ab
160k -vcodec libx264 -preset slow -profile:v baseline -level 30
-maxrate 10000000 -bufsize 10000000 -b 1000k -f flv rtmp://yourRTMPServer/Type/yourStreamName
replace Type in the link with your stream type (eg: live or VOD or Play or whatever your full RTMP link is written. You did not say so I can only guess its one of these three types).

Related

Is it possible to stream MJPEG content over MPEG-DASH?

I am trying to re-stream an MJPEG stream over dash using ffmpeg.
I have an ESP32 camera module that outputs an MJPEG livestream at 192.168.2.128:81/stream (Arduino code here).
I can open this stream directly in the browser and see the video in realtime, but the camera will only allow for a single client at a time while I am in need of a multi client solution.
What doesn't work
A solution I am currently trying to implement is to use a seperate server (Raspberry Pi) running apache and ffmpeg to re-stream the MJPEG content using DASH:
ffmpeg -re -i http://192.168.2.128:81/stream -strict -2 -an -c:v copy -b:v 2000k -f dash -window_size 4 -extra_window_size 0 -min_seg_duration 2000000 -remove_at_exit 1 /var/www/html/out.mpd
I get no errors when executing this command on the server.
I then use this ffmpeg-dash.html to display the video in the browser.
This code unfortunately fails, in Firefox the console reports the error:
[72][Stream] No streams to play.
followed by:
Cannot play media. No decoders for requested formats: video/mp4;codecs="mp4v.6c";width="640";height="480"
What does work
What is puzzling me is that the above code works fine if I replace the MJPEG livestream url with a sample .mkv file, so if I use
ffmpeg -re -i /var/www/html/video.mkv -strict -2 -an -c:v copy -b:v 2000k -f dash -window_size 4 -extra_window_size 0 -min_seg_duration 2000000 -remove_at_exit 1 /var/www/html/out.mpd
I can view the livestreamed sample video (video.mkv) without problems using the previously mentioned ffmpeg-dash.html file.
Furthermore, it seems that ffmpeg can read the MJPEG livestream without problems, since
ffmpeg -t 10 -i http://192.168.2.128:81/stream -filter:v fps=15 -c:v flv test.flv
returns a 10 second clip of the livestream succesfully.
So to me it seems that the problem lies in how I combine the two. What am I missing? Is it even possible to stream MJPEG content over MPEG-DASH?
(I am new to this, sorry in advance for my ignorance)

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: is it possible to record 1920x1080 screen with DSHOW?

I am currently working on a screen recorder in VB.net and i need ffmpeg to record my screen. I have the following ffmpeg code now:
ffmpeg.exe -f dshow -framerate 30 -i video="UScreenCapture":audio="Stereo Mix (Realtek High Definition Audio)" -filter_complex amix=inputs=1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -acodec pcm_s16le "output result file.mkv"
This works fine, but it only records a part of my screen. I already tried the registry keys (They weren't made, so i made them myself), but it also didn't work. Does anyone know how to do it?
thanks in advance for helping me.
just wanted to share this with you who have the same problem.
Problem solved
just right-click ffmpeg.exe. 2: Select properties 3: Select the compatibility 4: Check The High DPI windows thing and you're done
The following command works for me:
ffmpeg -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -f dshow -i audio="Microphone Array" RECORD.mp4
Here, "Microphone Array" is my default audio device, and the name is retrieved using:
ffmpeg -list_devices true -f dshow -i dummy
The advantage of above command is that it allows you to record multiple screens at once, or even one out of two screens, simply by changing the offset (-offset_x & -offset_y).

Wowza RTMP to RTSP

We're using a Raspicam to stream live video to a client using Wowza Streaming Engine. We use FFMPEG to encode and send to Wowza and we can succesfully watch the RTMP stream using JWPlayer. This is the FFMPEG command used:
ffmpeg -t 0 -s 320x240 -f video4linux2 -i /dev/video0 -b:v 250k -tune zerolatency -preset ultrafast -f flv -r 15 rtmp://wowzaaddress:1935/live/live
To be able to watch the stream on mobile devices we want to use RTSP or HLS which Wowza provides links to, however when we use those links (provided on the Test Player) nothing happens and we can't even open them to test for example in VLC. We have already added the extra ports on our web server to see if that was the problem and still didn't work.
Does anybody know what the problem is or what could we be doing wrong?

Streaming interruption issue

I am trying to send audio/video streams to justin.tv using the following command:
ffmpeg -i Engl_01.avi -re -acodec copy -ar 22050 -vcodec libx264 -f flv rtmp://live.justin.tv/app/live_.....
It works well for Linux but doesn't work under MS Windows 7: the site (justin.tv) shows me a movie with interruptions, why is this? Is there any option allowing ffmpeg to fix this problem for Windows?

Resources