FFMPEG Preview from Capture device - macos

I am using MacOS with FFMPEG --enabled-decklink installed to capture from BlackMagic Ultrastudio Expressto SDI to Thunderbolt and streams it to youtube, it works perfectly fine, here is my code.
ffmpeg -f decklink -format_code 'Hi50' -i 'UltraStudio Express'
-deinterlace -b:v 1M -vcodec h264 -pix_fmt yuv420p -color_range 1 -acodec aac -f flv rtmp://a.rtmp.youtube.com/live2/*******
but I am kinda blind cuz I cannot see what I am capturing till its live on Youtube, is there away to preview the video locally on my Mac before I start streaming via ffmpeg?

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)

FFMPEG udp stream to VLC

i've been trying to create a transport stream using FFMPEG, when i tried it in VLC it was working immediately, however when i stream from FFMPEG to VLC i can't get it to work, here's my string:
ffmpeg -re -i http://ip-of-shoutcast-stream:port?listen -c:a aac -b:a 128k -ar 44100 -ac 2 -vn -f mpegts udp://ip-of-destination-pc:1234?pkt_size=1316
In VLC i use the same network source i used when VLC was streaming in the main PC:
udp://ip-of-main-pc:1234
But it doesn't play or show any errors, the orange bar only goes back and forth endlessly.
What am i doing wrong in the FFMPEG and/or VLC side? It has to be FFMPEG since it's getting moved to a server.

Sending BlackMagic DeckLink Studio 4K over RTMP streams with FFmpeg

I'm trying to send a stream of video that's coming into a BlackMagic DeckLink Studio 4K capture card over a few different RTMP streams at once with FFmpeg. The command that I am doing it with is this:
ffmpeg -re -format_code Hi59 -f decklink -i 'DeckLink Studio 4K' -map 0 -flags +global_header -vcodec libx264 -crf 25 -preset medium -pix_fmt yuv422p -acodec aac -f tee "[f=flv]rtmp://ip1/live/test|[f=flv]rtmp://ip2/live/test.
However, whenever I send this video out, I just get color bars when looking at the stream. I tried using a different video source (the testsrc supplied by FFmpeg), and that sends out fine over RTMP to multiple stream destinations.
Is there something weird with how tee and the decklink stuff work in FFmpeg? Or is there an issue with my command?
If you see colors bars, that means that ffmpeg is connecting to the card and streaming fine but the card is giving the bars. Your command says that ffmpeg is expecting 1920X1080#29.97 interlaced, make sure that is the format into the Decklink. You can also try explicitly setting the connection type, example:
ffmpeg -re -format_code Hi59 -video_input sdi -f decklink -i 'DeckLink Studio 4K' -map 0 -flags +global_header -vcodec libx264 -crf 25 -preset medium -pix_fmt yuv422p -acodec aac -f tee "[f=flv]rtmp://ip1/live/test|[f=flv]rtmp://ip2/live/test
If you are still running into issues, make sure that the BlackMagic software can see the video signal, and it's the format you expect.
One last thing to check, if its an HDMI input make sure it is not HDCP; it's not supported.

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.

using ffmpeg for live streaming MPEG-TS with windows media services

I'm trying to live stream MPEG-TS source to Windows Media service.
I found how to live stream using RTMP with this code:
ffmpeg -y -f mpegts -i udp://#:1234 -re -vcodec libx264 -maxrate 700k
-r 25 -s 640x360 -deinterlace -acodec libvo_aacenc -ab 64k -ac 1 -ar 44100 -f flv "rtmp://rtmp1.youtube.com/videolive?sparams=<STREAM PARAMETERS HERE>"
How can I convert it to support WM9/VC1 format?
Does ffmpeg support pulling of the stream or only pushing to Windows Media services?
Windows Media Service can receive data only from Windows Media Encoder.
It can't work with RTMP which its flash technology.
if your input stream is a file or a capture device than you can use "Windows Live Media Encoder".

Resources