Playing RTMP streaming on Mac with VLC and rtmpdump
VLC is a great piece of software, but currently lacks RTMP support. The good news is that there might be some RTMP support planned for the 2.1 release.
Meanwhile, to fix this, here’s a simple workaround using rtmpdump.
First make sure you have rtmpdump installed. If not, you can install it using the Homebrew package manager:
brew install rtmpdump
Now make sure you have installed VLC and use the following command to play the RTMP streaming:
rtmpdump -r rtmp://foobar/live/stream --quiet | /Applications/VLC.app/Contents/MacOS/VLC -
This will open VLC with a file named fd://0 on the playlist. Just click it and the streaming should be working.
You can create a vlc alias to make the command a lot simpler. Just add this in your .bashrc, .zshrc or .profile (choose with one applies) and restart the terminal:
alias vlc=/Applications/VLC.app/Contents/MacOS/VLC
If you don’t like to mess around with long terminal commands, here’s a bash function that makes it simpler:
function rtmp_open() {
rtmpdump -r $1 --quiet | /Applications/VLC.app/Contents/MacOS/VLC fd://0 --playlist-autostart
}
Just copy paste this into your .bashrc, .zshrc or .profile (choose which one applies), and restart the terminal.
I had to use fd://0 instead of - to refer to stdin due to a bug in VLC that ignores the --playlist-autostart when using - as input.
Now to run this handy function just type the name and the URL of the RTMP stream you want to play:
$ rtmp_open rtmp://foobar/live/stream
And that’s it. Enjoy :)