[FFmpeg-user] FFmpeg on Apple Silicon (Success)

Steven Kan steven at kan.org
Sun Feb 7 08:29:29 EET 2021


> On Aug 7, 2020, at 1:02 PM, Aleksid <beautyofnorth at gmail.com> wrote:
> 
> Hi,
> 
> Just for information. Today I successfully compiled FFmpeg 4.3.1 for Apple
> Silicon (macOS 11 Beta Big Sur) on Apple Developer Transition Kit.

Hi!

Have you moved up to an M1-based Mac? How is the performance of ffmpeg on released Apple Silicon?

I am using ffmpeg to pull RTSP streams from my IP cameras and push them to my YouTube channels. Previously my commands were of the form:

./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.11:554" -vcodec copy -acodec copy -t 01:00:00 -f flv "rtmp://a.rtmp.youtube.com/my-youtube-streaming-key”

and this took almost no CPU because there’s no transcoding. I can run 3 instances of ffmpeg on Raspberry Pi 3 without using more than 50% CPU, total.

Now I want to stack 2 streams horizontally using something like:

./ffmpeg -re -thread_queue_size 1024 -i rtsp://anonymous:password@192.168.1.47:554 -i rtsp://anonymous:password@192.168.1.50:554 -vcodec <some good codec> -acodec copy -t 01:00:00 -filter_complex "nullsrc=size=3840x1080 [base]; [0:v] setpts=PTS-STARTPTS, scale=1920x1080 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1920x1080 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=1920" -f flv "rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key”

or

./ffmpeg -re -thread_queue_size 1024 -i rtsp://anonymous:password@192.168.1.47:554 -i rtsp://anonymous:password@192.168.1.50:554 -vcodec <some good codec> -acodec copy -t 01:00:00 -filter_complex hstack=inputs=2 -f "rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key"

I have a few old Windows computers lying around, and they struggle with this, running upwards of 60-80% CPU, even with -vcodec h264_amf on my AMD box pushing much of the load to the integrated GPU, which runs at 55%. I can’t get h264_qsv to work on my Intel box, and I can’t get hstack to work if the two cameras have two different color spaces.

I can run this on my 2014 MacBook Pro with Nvidia GPU, using h264_videotoolbox:

./ffmpeg -re -thread_queue_size 1024 -i rtsp://anonymous:password@192.168.1.47:554 -i rtsp://anonymous:password@192.168.1.50:554 -vcodec h264_videotoolbox -acodec copy -t 01:00:00 -filter_complex "nullsrc=size=3840x1080 [base]; [0:v] setpts=PTS-STARTPTS, scale=1920x1080 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1920x1080 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=1920" -f flv "rtmp://a.rtmp.youtube.com/live2/rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key"

and it runs at ~66% CPU, but both Intel Iris and nVIDIA GPUs report 0% in Activity Monitor. Furthermore this is my main work computer, so I can’t have it running ffmpeg all day long.

I actually want to run two such channels, so two instances of ffmpeg, and I don’t want to heat my house or have a loud fan blowing constantly.

Does ffmpeg on AS use the integrated GPU? Do you think an AS Mini would be able to run two instances of either form of those commands listed above, e.g. two different, 2-up, side-by-side videos, each 3840 x 1280?

The mini is a nice, quiet box that I could hide in one of my closets. At $700 it’s not cheap, but even a refurbed Core i7 that could do what I want would cost in the same neighborhood, I think. Unless I’m just doing it wrong, which also is possible. Thanks!


More information about the ffmpeg-user mailing list