drhans
Posts: 1
Joined: Fri Jun 24, 2016 7:14 am

ffmpeg & h264_omx on pi3 very slow

Fri Jun 24, 2016 7:16 am

transoding h264 1080i @ 15Mbps to h264_omx still kills the raspberry, CPU running at 150%, resulting in choppy video - any suggestions?

Code: Select all

./ffmpeg -i "http://pi:17999/stream/service/1c7d56b7dbf9cf0f51c0b9a6e4fe1eda?profile=pass&descramble=0&emm=1&:0:0:d" -f mpeg2video -vcodec h264_omx -probesize 32 -analyzeduration 0 -f mpegts -
pi3 cpu at 150+ %, transoded output choppy, unwatchable

dickon
Posts: 216
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: ffmpeg & h264_omx on pi3 very slow

Sun Jun 26, 2016 10:23 am

Have you got any buffering?

freman
Posts: 7
Joined: Thu Mar 24, 2016 2:42 am

Re: ffmpeg & h264_omx on pi3 very slow

Tue Jun 28, 2016 11:46 pm

Which version of ffmpeg are you using?
ffmpeg-3.1 now supports hardware assist h264 encoding.

I did a quick test on my RPI3:
./ffmpeg-3.1 -f v4l2 -input_format yuv420p -framerate 30 -video_size 720x480 -i /dev/video0 -frames 5000 -an test.h264

the cpu was less than 8% busy...

ILiveAHoodie
Posts: 10
Joined: Wed Jul 13, 2016 12:47 pm

Re: ffmpeg & h264_omx on pi3 very slow

Wed Jul 13, 2016 12:52 pm

What OS did you install FFmpeg 3.1 on? Is this working on Raspbian (Jessie)? Very interested in hardware h264 on RP. :mrgreen:

freman
Posts: 7
Joined: Thu Mar 24, 2016 2:42 am

Re: ffmpeg & h264_omx on pi3 very slow

Wed Jul 13, 2016 2:44 pm

Hi,
I am using jessie.
uname -a
Linux raspberrypi 4.4.13-v7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux

ILiveAHoodie
Posts: 10
Joined: Wed Jul 13, 2016 12:47 pm

Re: ffmpeg & h264_omx on pi3 very slow

Thu Jul 14, 2016 5:05 am

Did you download and install the official repo from the website.

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

What compile commands did you use?

Im running Jessie and would like to attempt your same configuration. Will let you know if i get the same results.

ILiveAHoodie
Posts: 10
Joined: Wed Jul 13, 2016 12:47 pm

Re: ffmpeg & h264_omx on pi3 very slow

Thu Jul 14, 2016 8:55 pm

Ok. I've been able to compile FFMPEG 3.1 with omx enabled. On my test I've been getting 12-13fps when converting gopro video to a lower end h264. It should also be noted that if you give it any filters (like scale) it slows down to 4fps or less. Those are my results.

User avatar
jbeale
Posts: 3266
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: ffmpeg & h264_omx on pi3 very slow

Thu Jul 14, 2016 9:35 pm

What resolution are you using? For what it's worth, I was able to get 10 fps encoding doing a live recording from a 1280x720 webcam with this command:

Code: Select all

ffmpeg -f video4linux2 -i /dev/video0 -s 1280x720 -c:v h264_omx  output.mp4
and that speed limit was due to the USB source device, not due to ffmpeg. I may have actually got 30 fps at 1280x720 using the MJPEG format from the webcam instead of YUYV, but I'll have to check when I get back to my desk.

ILiveAHoodie
Posts: 10
Joined: Wed Jul 13, 2016 12:47 pm

Re: ffmpeg & h264_omx on pi3 very slow

Fri Jul 15, 2016 8:50 am

In my tests i was using a 15Mbps h264 video at 1920x1080, 29.97. Going down to 4Mbps h264 ran at 12-13fps while converting. Adding a scale filter to 1280x720 made it convert at 4fps.

User avatar
jbeale
Posts: 3266
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: ffmpeg & h264_omx on pi3 very slow

Fri Jul 15, 2016 1:51 pm

If the source was already in h.264 format then you have to decode, then re-encode so I assume that cut down the speed relative to encoding from raw.

ILiveAHoodie
Posts: 10
Joined: Wed Jul 13, 2016 12:47 pm

Re: ffmpeg & h264_omx on pi3 very slow

Fri Jul 22, 2016 12:10 pm

I've tested with an HD MOV file under low compression. It averaged a transcode speed of 1.4 FPS going to H264.
Is anyone else getting speeds like this?

gkreidl
Posts: 5249
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: ffmpeg & h264_omx on pi3 very slow

Fri Jul 22, 2016 3:53 pm

Perhaps you should use gstreamer-1.0 and the gst-omx module. I use it for real time transcoding of all kinds of sources (756p h264 and MPEG2, 720p50 H264 and 1080i50) to lower resolutions and bit rates.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

ILiveAHoodie
Posts: 10
Joined: Wed Jul 13, 2016 12:47 pm

Re: ffmpeg & h264_omx on pi3 very slow

Fri Jul 22, 2016 8:52 pm

Does gst-omx have a plugin for FFMPEG? I've never used it before.

gkreidl
Posts: 5249
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: ffmpeg & h264_omx on pi3 very slow

Sat Jul 23, 2016 4:18 am

ILiveAHoodie wrote:Does gst-omx have a plugin for FFMPEG? I've never used it before.
No. gst-omx is a plugin for gstreamer-1.0. You could use gst-launch-1.0 with a tool chain to replace what you are trying to do with ffmpeg. But it's a real pain to use.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

blackshard83
Posts: 67
Joined: Fri Jan 10, 2014 8:31 am

Re: ffmpeg & h264_omx on pi3 very slow

Fri Feb 10, 2017 3:38 pm

Don't expect miracles, the h264 hardware encoder is pretty basic and produces very low quality output even at high bitrates, and software encoding is still very slow on ARM machines.

gkreidl
Posts: 5249
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: ffmpeg & h264_omx on pi3 very slow

Fri Feb 10, 2017 3:59 pm

blackshard83 wrote:Don't expect miracles, the h264 hardware encoder is pretty basic and produces very low quality output even at high bitrates, and software encoding is still very slow on ARM machines.
No, the quality is quite good, even if it cannot compare with a multipass software encoder. I'm using it all the time.
And encoding by software isn't that slow with Handbrake (using NEON). SD video can be re-encoded faster than real time.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Return to “OpenMAX”

Who is online

Users browsing this forum: No registered users and 2 guests