I am new to both Wowza and to FFMPEG. I have been testing with ffmpeg and I am able to create local files with video and audio. For example:
ffmpeg -f dshow -i video="HD Pro Webcam C920" myvideo.mpeg
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920":audio="Microphone (Parallels Audio Con" -pix_fmt yuv420p myvideoandaudio.mp4
What I want to do is send the stream of my webcam to the Wowza server I have installed locally. I have searched several forums, including this one, and have tried multiple commands but still no luck. I would like to have someone point me in the right direction. Following Wowza's instructions, I created a Stream File called mystream, which has a stream UI of udp://0.0.0.0:10100. Also, the application connection settings say that the server's IP is 10.160.XX.XXX and port 1935. I am using Windows, and the "Shared" version of the FFMPEG downloads. I even changed the XML file following the instructions here, trying to send user credentials (during installation, Wowza asked to create credentials if I was going to use streaming):
http://www.wowza.com/forums/content.php?233-How-to-secure-publishing-from-an-RTMP-encoder-that-does-not-support-authentication-(ModuleSecureURLParams)
I have tried all the following commands:
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv rtmp://localhost:1935/live/mystream
-- failed to connect socket
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv rtmp://localhost/live/mystream
-- failed to read RTMP packet header
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv rtmp://10.160.XX.XXX:1935/live/mystream
-- failed to read RTMP packet header
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv rtmp://10.160.XX.XXX/live/mystream
-- failed to read RTMP packet header
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv rtmp://127.0.0.1:1935/live/mystream
-- failed to read RTMP packet header
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv rtmp://127.0.0.1/live/mystream
-- writeN, rtmp send error 10053
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920" -f flv -vcodec libx264 -acodec aac -strict -2 rtmp://10.160.XX.XXX:1935/live/ivanstream
-- failed to read RTMP packet header
ffmpeg -f dshow -i video="HD Pro Webcam C920" -vcodec libx264 -tune zerolatency -b:v 900k -pix_fmt yuv420p -f mpegts udp://0.0.0.0:10100
-- conversion failed
ffmpeg -f dshow -i video="HD Pro Webcam C920":audio="Microphone (Parallels Audio Con" -vcodec libx264 -preset ultrafast -tune zerolatency -r 10 -async 1 -acodec libmp3lame -ab 24k -ar 22050 -bsf:v h264_mp4toannexb -maxrate 750k -bufsize 3000k -f mpegts udp://0.0.0.0:10100
-- conversion failed
ffmpeg -f dshow -i video="HD Pro Webcam C920" -s 512x288 -vcodec libx264 -b:v 1024k -pix_fmt yuv420p -f flv rtmp://127.0.0.1:1935/live/mystream
-- failed to read rtmp packet header
ffmpeg -f dshow -i video="HD Pro Webcam C920" -c:v copy -c:a copy -f flv rtmp://10.160.XX.XXX:1935/live?doPublish=12345/mystream
-- failed to read rtmp packet header
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920":audio="Microphone (Parallels Audio Con" -r 40 -vcodec libx264 -threads 0 -crf 0 -preset ultrafast -tune zerolatency -f flv rtmp://127.0.0.1:1935/live/mystream
ffmpeg -rtbufsize 1500M -f dshow -i video="HD Pro Webcam C920":audio="Microphone (Parallels Audio Con" -r 40 -vcodec libx264 -threads 0 -crf 0 -preset ultrafast -tune zerolatency -f flv rtmp://10.160.XX.XXX:1935/live/mystream
-- rtmp header error
ffmpeg -y -f dshow -s 640x480 -r:v 15 -i video="HD Pro Webcam C920":audio="Microphone (Parallels Audio Con" -c:v libx264 -b:v -pix_fmt yuv420p -vb 450 -an -map 0:0 -f rtp rtp://127.0.0.1:10000 -flags +global_header -c:a libvo_aacenc -vn -map 0:1 -f rtp rtp://127.0.0.1:10002 > 10000.sdp
--unable to find suitable output format yuv420p
References:
http://www.wowza.com/forums/showthread.php?25777-Live-Webcam-feed-to-WOWZA-Server-over-RTMP-with-H264-encoding
http://www.factsandpeople.com/facts-mainmenu-5/23-other-software-technologies/258-preventing-real-time-buffer-error-causing-ffmpeg-to-drop-frames-in-screencast
http://www.wowza.com/forums/content.php?233-How-to-secure-publishing-from-an-RTMP-encoder-that-does-not-support-authentication-(ModuleSecureURLParams)
Thank you.
Related
I want to add audio to my ffmpeg cli bellow
ffmpeg -framerate 25 -video_size 1920x1080 -f x11grab -i :0.0 -vf format=yuv420p http://localhost:8080/feed.ffm
I tried -acodec libmp3lame, -c:a libmp3lame but it does not seam to work
You have to provide an audio input. Assuming ALSA:
ffmpeg -framerate 25 -video_size 1920x1080 -f x11grab -i :0.0 -f alsa -sample_rate 48000 -channels 2 -i hw:0 -c:v libx264 -c:a aac -vf format=yuv420p http://localhost:8080/feed.ffm
See FFmpeg ALSA input documentation and FFmpeg Wiki: ALSA.
I want to send the livestream of my webcam to YouTube. I can follow YouTube's guide up to step 8. "Stream Connection" tells me there is "No data" and the button "Go Live" remains unclickable. A screenshot of this situation can be seen at
As encoding software, I was planning on using FFmpeg because it can run from the target platform, a Raspberry Pi with Raspbian. A USB webcam supported by video4linux2 is used.
FFmpeg's wiki shows that streaming a file can be done with the following:
ffmpeg -re -i input.mkv \
-c:v libx264 -preset veryfast -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 \
-ar 44100 -f flv rtmp://live.twitch.tv/app/<stream key>
I modified this command in the following ways:
1. It takes the video stream from the webcam with -f v4l2 -i /dev/video0.
2. It does not broadcast any audio with -an.
3. It broadcasts to YouTube's RTMP server, rtmp://a.rtmp.youtube.com/live2/<stream key>
The final version of the command is now:
RTMP_URL="rtmp://a.rtmp.youtube.com/live2"
STREAM_KEY="secr-etse-cret-secr"
OUTPUT=$RTMP_URL/$STREAM_KEY
ffmpeg -re -f v4l2 -i /dev/video0 \
-c:v libx264 -preset veryfast -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -an \
-f flv $OUTPUT
When I run this command, I would expect that "Stream connection" would change to something else than "No data" after a few seconds, but that does not happen.
I have tried recording the stream to a local file with:
ffmpeg -re -f v4l2 -i /dev/video0 \
-c:v libx264 -preset veryfast -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -an \
-f flv test.flv
This worked fine. That demonstrates to me that the issue is with getting the video stream accepted by YouTube.
The code below works very well using Windows, you may adjust to fit for your need
ffmpeg -loglevel debug -threads:v 2 -threads:a 8 -filter_threads 2 -thread_queue_size 512 -f dshow -i video="HP Wide Vision HD" -f dshow -i audio="Microphone Array (Realtek Audio)" -pix_fmt yuv420p -c:v libx264 -qp:v 19 -profile:v high -rc:v cbr_ld_hq -level:v 4.2 -r:v 60 -g:v 120 -bf:v 3 -refs:v 16 -f flv rtmp://youtube_stream_url/stream_key
single video delays 49ms
ffmpeg -rtbufsize 100M -f dshow -i video="Logitech HD Webcam C270" -vcodec libx264 -r 30-g 5 -preset:v ultrafast -tune:v zerolatency -f rtsp rtsp://127.0.0.1:80/live/test
The delay was 100 ms after adding audio.
ffmpeg -rtbufsize 100M -f dshow -i video="Logitech HD Webcam C270":audio="麦克风 (HD Webcam C270)" -vcodec libx264 -g 5 -r 30 -acodec aac -preset:v ultrafast -tune:v zerolatency -f rtsp rtsp://127.0.0.1:80/live/tao
Is it normal? Is there any solution to reduce the delay?
Is there any way to have a secure UDP broadcast with FFmpeg by requesting username and password.
I've used this command to broadcast
ffmpeg -f dshow -video_size 1280x720 -rtbufsize 702000K -framerate 30 -i video="Video (00-0 Pro Capture Quad HDMI)" -r 30 -threads 4 -vcodec libx264 -crf 0 -preset ultrafast -f mpegts "udp://192.168.1.12:6666"
and I received it by open VLC using this
udp://#192.168.1.12:6666
How to provide a username and password to open this broadcast ???
It may work for you...
Stream
ffmpeg -f dshow -video_size 1280x720 -rtbufsize 702000K -framerate 30 -i video="Video (00-0 Pro Capture Quad HDMI)" -r 30 -threads 4 -vcodec libx264 -crf 0 -preset ultrafast -f mpegts "udp://username:password#192.168.1.12:6666"
Open
udp://username:password#192.168.1.12:6666
I was trying to create an FFMpeg stream and read it from VLC player, but I am getting an error saying SDP is required. However FFMpeg is not printing the SDP information to console as it is supposed to. How can I get the SDP file for the stream?
Here is the command I am using to stream
ffmpeg -f dshow -r 10000/1001 -i video="screen-capture-recorder" -vcodec libx264 -tune zerolatency -b 900k -f mpegts rtp://127.0.0.1:1234
I found out what I had done wrong. I was previously using this command:
ffmpeg -f dshow -r 10000/1001 -i video="screen-capture-recorder" -vcodec libx264 -tune zerolatency -b 900k -f mpegts rtp://127.0.0.1:1234
Which I changed to this:
ffmpeg -f dshow -r 10000/1001 -i video="screen-capture-recorder" -vcodec libx264 -tune zerolatency -b 900k -f rtp rtp://127.0.0.1:1234
I just changed "mpegts" to "rtp" since that is the protocol I was using.