Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

FFmpeg hardware accelerated transcoding

Here you can post a testimonial about why you like or love MEPIS. Include as much detail and info as you wish.
Post Reply
Message
Author
clicktician
Forum Regular
Forum Regular
Posts: 188
Joined: Sat May 02, 2015 4:35 pm

FFmpeg hardware accelerated transcoding

#1 Post by clicktician » Thu Sep 13, 2018 11:30 am

Many thanks to the MX dev team for the great work getting hardware acceleration integrated in the FFmpeg 3.x build. (Probably Stevo's handy work).
Video transcoding is something I do every day, and I just took it for granted that FFmpeg was the same on all distros. Oh, no it's not!

At a friend's house last nite (a wool-dyed Ubuntu/Mint family) and he was transcoding a 96 minute bluray mkv movie to dvd quality mp4 to load on his phone. After an hour went by, I volunteered to do it on my MX17 tablet.
It took 4 mins.

To my surprise, his FFmpeg build had no GPU support.
I got home and felt so grateful that this stuff just works for me on MX without a big fight.
Son, someday all this will belong to your ex wife.

User avatar
Stevo
Forum Veteran
Forum Veteran
Posts: 16540
Joined: Fri Dec 15, 2006 8:07 pm

Re: FFmpeg hardware accelerated transcoding

#2 Post by Stevo » Thu Sep 13, 2018 1:17 pm

Give credit to the Debian team for having the hardware acceleration built in for ffmpeg, not me; I just backport their configuration...though if you're talking about using Handbrake with Intel GPU support, we're porting the deb-multimedia version which leverages libmfx for that, which the Debian/Ubuntu/Mint versions do not.

clicktician
Forum Regular
Forum Regular
Posts: 188
Joined: Sat May 02, 2015 4:35 pm

Re: FFmpeg hardware accelerated transcoding

#3 Post by clicktician » Thu Sep 13, 2018 2:11 pm

Stevo wrote:
Thu Sep 13, 2018 1:17 pm
Give credit to the Debian team for having the hardware acceleration built in for ffmpeg, not me; I just backport their configuration...though if you're talking about using Handbrake with Intel GPU support, we're porting the deb-multimedia version which leverages libmfx for that, which the Debian/Ubuntu/Mint versions do not.
Excellent. I use the heck out of FFmpeg because it has hardware accel. I'd use Handbrake a lot more if it had it, too. Can't wait.
Son, someday all this will belong to your ex wife.

User avatar
Stevo
Forum Veteran
Forum Veteran
Posts: 16540
Joined: Fri Dec 15, 2006 8:07 pm

Re: FFmpeg hardware accelerated transcoding

#4 Post by Stevo » Thu Sep 13, 2018 4:01 pm

clicktician wrote:
Thu Sep 13, 2018 2:11 pm
Stevo wrote:
Thu Sep 13, 2018 1:17 pm
Give credit to the Debian team for having the hardware acceleration built in for ffmpeg, not me; I just backport their configuration...though if you're talking about using Handbrake with Intel GPU support, we're porting the deb-multimedia version which leverages libmfx for that, which the Debian/Ubuntu/Mint versions do not.
Excellent. I use the heck out of FFmpeg because it has hardware accel. I'd use Handbrake a lot more if it had it, too. Can't wait.
What was it using in your tablet? Did you have to pass any special flag in the ffmpeg command?

clicktician
Forum Regular
Forum Regular
Posts: 188
Joined: Sat May 02, 2015 4:35 pm

Re: FFmpeg hardware accelerated transcoding

#5 Post by clicktician » Thu Sep 13, 2018 5:28 pm

Stevo wrote:
Thu Sep 13, 2018 4:01 pm
What was it using in your tablet? Did you have to pass any special flag in the ffmpeg command?
Oh, yeah. You have to tell FFmpeg explicitly to use Nvidia, AMD, or Intel. It has a special set of args for them. On my tablet (a dinky Intel atom with 6xx gpu), it's the standard vaapi set. So, I used something like this:

Code: Select all

/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mkv -vf 'hwupload,fps=29.97,scale_vaapi=w=864:h=486:format=nv12' -c:v h264_vaapi -threads 0 -qp 20 -acodec copy output.mp4
In this case, I wanted to open the mp4 stream of the mkv file, upload the frames to the device "renderD128", then I wanted the hardware to filter it to 29.97 fps and scale down to dvd resolution. The original color space was in yuv420p, but intel hardware only understands nv12, so FFmpeg had to filter the format, too. Normally you would download the frames to FFmpeg's memory space (hwdownload) and process the output there, but I told it to let the GPU re-encode the frames as h264_vaapi because it's mucho presto presto. The audio on the mkv was already AAC, so I just copied it to the output mp4 container, but I could have re-encoded it, too. The -threads arg is probably the default, but I always throw it in for good measure out of habit. -qp, of course, is the quality and lower is better. The Intel hardware can also deinterlace if you want the output progressive, but the mkv stream was already progressive.

I have the 965 driver installed, along with vainfo.

Code: Select all

apt-get install i965-va-driver vainfo
You can see what capabilities your Intel GPU has with the "vainfo" command. But I'm sure you can process mpg1-2, divix, h264, and h265 on anything that's recent.
Son, someday all this will belong to your ex wife.

Post Reply

Return to “Testimonials”