Twitch with HDPVR and ffmpeg on a mac

Tutorial: HD-PVR to Twitch on Mac OS with ffmpeg

Over the christmas holidays I tried to figure out how to live stream the video from my HD-PVR to on Mac OS with ffmpeg without CamTwist, without XSplit and without JTVLC. Twitch.TV is a video broadcast service where you can stream and watch your gaming content. Its main purpose is for the e-sport and speedrun community but there are more and more normal gamers streaming their content – including me since a few days.

Streaming without preview windows recording

I am not able understand why most people try to record a preview window of the HD-PVR with a desktop recording software. The HD-PVR sends a high quality 1920 × 1080 pixel MPEGTS Stream over HDMI or Component and I thought that is should be possible to process this stream directly. It seems like it is possible and it quite easy if you know how to do it.

The downside is that I don’t know any option to include a stream from a webcam and microphone. Maybe someone else is more clever than me and will provide one. The HD-PVR Capture Software will cost you $30 but it is worth any penny for people who want to record their recorded HD-PVR footage with a mac . Here we go.

Step 1 : Configuring HD-PVR Capture

Download and install HD-PVR Capture. There is also a demo version available.

With this software we will send the output signal of the HDPVR to the ffmpeg encoder using UDP. I strongly prefer this software over Arcsoft Showbiz on Windows because of its simplicity and reliability.

HD-PVR Capture UDP Streaming Mac

In HD-PVR Capture are two important settings: Video Encoder and Network.

Video Encoder

  • Select the preset „best“.
    Personally I think that the insane setting is unnecessary in this case because we will encode the video for web streaming.


  • Uncheck the „Store video recording“ option.
    We don’t want to fill up our hard drives with tons of videos.
  • Check the „Send the captured video to network using UDP“ option.
    As the IP address use your local ip and the port 1234.

You can verify that it works this if you press the record button, start VLC and go to file -> open network and put this into the address field: udp://@:1234. Hit the play button and you should see the output video mpegts stream of your HDPVR.

Dashboard: Live streaming Twitch with HDPVR and ffmpeg on a mac

Step 2: Setting up ffmpeg

Download and install ffmpeg for mac. You can do this via „brew„. Inside the zip archive you will find the the extracted file „ffmpeg“. This is the executable file and should be moved to the directory /usr/local/bin/. You can do this using Terminal with the command:

sudo mv ~/Downloads/ffmpeg /usr/local/bin/ 

Or copy it with the finder from Downloads to the /usr/local/bin/ folder.

Step 3: Executing the ffmpeg command

This is the ffmpeg command with several parameters which has to be executed using the Terminal. This will grab the stream from HDPVR Capture, encode it on the fly and sent it directly to the twitch servers.

ffmpeg -f mpegts -re -i 'udp://' -vcodec libx264 -s 1280x720 -g:v 40 -threads 4 -preset medium -b:v 850k -minrate 850k -maxrate 850k -bufsize 1600k -r 30 -acodec libmp3lame -ar 44100 -b:a 64k -async 44100 -f flv "rtmp://"

Replace live_XXXXX_XXXXXXXX with your personal Key and then use this command on the terminal to stream the UDP Stream from HDPVR Capture to

Here is a little explanation of the few options I think I understand:

Sets the input format to MPEGTS. Should be set automatically but I wanted to be sure.
-i Sets the UDP stream from HD-PVR Capture as the input file for the encoding.
Parameters for the UDP stream. buffer_size was my missing piece to
get rid of the artifacts I was getting in twitch. Took me 2 days to figure this out.
-reactivates realtime mode
-vcodecSets the video codec to libx264. It is an open source video codec for H.264.
-sThe resolution of the encoded output format. I chose 720p because it made the most sense to me. Change this if you need to.
UPDATE: Changed it to 720p. Better quality.
-g:vSets the maximum keyframe interval to 2. Important for twitch.
qscale:v Sets the quality scale. :v means that this is only used for video and not audio. 1 is best, 31 is worst.
UPDATE: Removed this part because -b:v overrides this setting.
-threadsSpecifies the number of CPU Threads used for encoding. I use 6 on my Core i7.
UPDATE: Removed.
-presetThere are many presets for the encoder from ultrafast, fast and medium to slow and very slow. Ultrafast is too blocky. The presets „medium“ and „fast“ seem right.
Sets the encoding bitrate to 800 kbytes with a maximum and minimum bitrate of 800 kbytes excluding audio. This simulates a Constant Bitrate (CBR) which is important for twitch. Change this if you have more bandwidth for the upstream than me (10Mbit).
-bufsizeHonestly I don’t really understand what it does. I think this is the size of the buffer for the encoding but I am not sure. I read that this is important for the CBR.
-r Sets the frame rate to 30 frames per second. Change this if you like.
Sets the LAME Audio as audio encoder with a sample rate of 44,100 Hz and 64kbytes per second for the encoding.
-fSets the output format to a FLV container.
rtmprtmp:// sets the output format to Real Time Messaging Protocol with the server address of or live_XXXX_XXXXXXXXXX has the be replace with your personal API Key. You will find the key on your dashboard under API Key.

The result should look like this:

ffmpeg udp input and flv output

Step 4: Check the twitch dashboard

The UDP Stream from the HD-PVR Capture software is now used by the ffmpeg encoder and is directly send to the twitch servers using RTMP. I get a descent result, a stable frame rate of 30 frames, nearly no compression artifacts and a Stream Configuration Quality: Excellent message on twitch. I don’t know why there are these not-existing PPS referenced error messages showing up but it does not seem to harm the stream quality.

I developed a plugin for wordpress MarcTV Twitch Status which shows the „Live!“-Status of your Twitch account.

You can find my twitch channel here. Feel free to correct my settings and post them in the comment section below.

Streaming Capture Test

Beitrag veröffentlicht


, ,



47 Antworten zu „Tutorial: HD-PVR to Twitch on Mac OS with ffmpeg“

  1. Avatar von ben_

    I haz no clue, what dis Article is all about, but it looks pretty tekky with da Terminal-Screenshotz. And why the hell I am talking Engrish? :)

    Happy New Year, my Dear!

    1. Avatar von Marc

      It’s about how to stream videogame videos live to a service call You can watch me play =)

    2. Avatar von ben_

      Dis is sooo crazy, you crazy Motherfrakker! :)

  2. Avatar von Marc

    I developed a WordPress Plugin MarcTV Twitch Status to display the twitch status.

  3. Avatar von Evan Shanks
    Evan Shanks

    Ich bin nicht sicher, wie alt ist dieser Artikel, aber alles funktioniert gut, außer für die Kommandozeile im Terminal. Ich habe alles genau so, wie Sie zu der in diesem HowTo konnten aber nicht Terminal, mit mir zu kooperieren. Dies hat sehr frustrierend für mich, so dass, wenn es eine Möglichkeit gibt Sie wieder zu mir könnte, das wäre toll.

    1. Avatar von Evan Shanks
      Evan Shanks

      Sorry für die schlechte Übersetzung. Ich musste Google verwenden, weil es hat mir gesagt, Englisch war Spam.

    2. Avatar von Marc

      Sorry for the inconvenience. English should now be allowed in the comments.

      Did you install ffmpeg?
      Did you insert your twitch key correctly?

      What happens after you used the ffmpeg command in the terminal? Any error messages?

  4. Avatar von Peter

    I’ve used hdpvr capture for mac for a while now so I get everything on step 1 but when I start step 2 my ffmpeg doesn’t look the same as yours in terminal and I can’t type anything in it.

    1. Avatar von Marc

      What do you mean by looks different? Can you please copy the output of the terminal? Do you see the preview in Vlc if you hit the preview button in HDPRV capture?

    2. Avatar von Peter

      Thanks for the quick response. I should have checked for a reply earlier. I can see the preview of my recording on Vlc. As for step 2, when I open ffmpeg it gives me this (below). Am I supposed to open up a new blank terminal and then type in everything by hand? Any help is very appreciated.

      Last login: Wed Feb 19 05:16:02 on ttys000
      SMBP-0958:~ s150789$ /Users/s150789/Downloads/ffmpeg-2 ; exit;
      ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
      built on Jan 17 2014 09:39:01 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
      configuration: –prefix=/Volumes/Ramdisk/sw –enable-gpl –enable-pthreads –enable-version3 –enable-libspeex –enable-libvpx –disable-decoder=libvpx –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-avfilter –enable-libopencore_amrwb –enable-libopencore_amrnb –enable-filters –enable-libgsm –arch=x86_64 –enable-runtime-cpudetect
      libavutil 52. 48.101 / 52. 48.101
      libavcodec 55. 39.101 / 55. 39.101
      libavformat 55. 19.104 / 55. 19.104
      libavdevice 55. 5.100 / 55. 5.100
      libavfilter 3. 90.100 / 3. 90.100
      libswscale 2. 5.101 / 2. 5.101
      libswresample 0. 17.104 / 0. 17.104
      libpostproc 52. 3.100 / 52. 3.100
      Hyper fast Audio and Video encoder
      usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

      Use -h to get full help or, even better, run ‚man ffmpeg‘

    3. Avatar von Peter

      I should add, I’m not very experienced with using terminal. I’ve also tried copying the whole ffmpeg command with my twitch key and nothing happens.

    4. Avatar von Marc

      Please copy the whole command and show me the output. In your first example you executed only ffmepg without the parameters.

    5. Avatar von Peter

      > ffmpeg -f mpegts -i ‚udp://
      fifo_size=1000000&buffer_size=10000000&overrun_nonfatal=1‘ -vcodec libx264 -s 1280×720 -g:v 40 -qscale:v 2 -threads 4 -preset medium -b:v 1136k -minrate 1300k -maxrate 1300k -bufsize 8000k -r 30 -acodec libmp3lame -ar 44100 -b:a 64k -f flv „rtmp:// twitch key)
      -bash: ffmpeg: command not found

      My HDPVRCapture is sending the video to the IP address but I can’t get the command to work and stream it on twitch.

    6. Avatar von Marc

      -bash: ffmpeg: command not found means that ffmpeg is not installed correctly. Did you copy it to /usr/local/bin ? The command needs to be available everywhere and should be within the path variable. Or execute the command inside the folder where you extracted ffmpeg.

    7. Avatar von Jogadrogba

      Could you make a youtube video of you doing all this?

  5. Avatar von FuurinRei

    Cheers! I just got my first Mac and i tried this setup and it works flawless!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert