I'm using RaspberryPi 1gen B+, for push stream to web through rtmp. But I find my CPU usage came up to 90%+. This is how I use it:

ffmpeg -re -f concat -safe 0 -i playlist.txt -vcodec copy -acodec aac -f flv "rtmp://example.com:1060"

so I want to use the GPU for decode/encode. After google research, I found "h264_omx", and I've implement the h264_omx:

pi@pi:/usr/src/ffmpeg $ sudo ./configure --enable-omx --enable-omx-rpi
sudo make
sudo make install

so I use:

ffmpeg -re -f concat -safe 0 -i playlist.txt -vcodec h264_omx -acodec aac -f flv "rtmp://example.com:1060"

output is here:


But the CPU usage still runs to 90%+, what's worse, the video become indistinct and only have 5fps.

so, what's wrong with me? Is it possible for 1gen B+ to hardware codec?

  • 1
    -vcodec copy will always be faster. This means you want to do zero processing on the mp4 video stream. You shouldn't need to transcode the video from mp4 to mp4 for a flv stream. I suspect the issue is the acc audio stream. Try replacing -acodec acc with -acodec copy. – Aron Jun 26 '17 at 3:00
  • @Aron I thought I'v used "-acodec copy". It warns sth like "flv not xxxx aac" – Wayne Chen Jun 26 '17 at 3:57
  • Try using -an instead of -acodec copy as a debug step. This should strip out the audio...if it works, it is because your audio transcode step is too slow. – Aron Jun 26 '17 at 4:00
  • @Aron thinks,I will try it later. what I actually want to get is lower the CPU usage. – Wayne Chen Jun 26 '17 at 4:09
  • vcodec copy should already be giving you the lowest CPU usage possible for the video stream (0% usage since it is simply copying it). Your problem ISN'T the video codec. – Aron Jun 26 '17 at 4:11

I think I got running what you are looking for.
I use my setup to stream from my PC at ~50000KBit ~720p H264 local to my RaspberryPi3 running a nginx/rtmp server and crunch down the stream via ffmpeg with hardware acceleration and send this stream than to twitch at 3500KBit.
Is that what you are looking for? On the first look I think you are missing the decoding acceleration.

Stream #0:1 -> #0:0 (h264 (nativ) -> h264 (h264_omx))
You decode the stream with the software codec and encode again with hardware codec. the software codec is causing the cpu to sturggle.

Stream #0:1 -> #0:0 (h264 (h264_mmal) -> h264 (h264_omx))
This way you use the h264_mmal hardware acceleration to decode and the h264_omx hardware acceleration to encode.

I wor on an install script for this setup and willing to share. If that is what you are looking for I can help you.
You can view the results at my twitch channel https://www.twitch.tv/jeezz

  • Thanks for your help. I debuged yesterday with -an, the CPU usage lowed to normal.So the audio transcode is the key of my question.So I just to transcode audio to aac on PC, the trouble is gone.Thank you all the same. – Wayne Chen Jun 28 '17 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.