Jump to content

Raspberry Pi 4 hw encdoing works :)


GreatLord

Recommended Posts

GreatLord
Hi

 

I just got hold on Raspberry 4 with 4GB ram and run with Raspberry Pi Desktop full desktop install and I got hw encoding working fine. 

 

I have try from raspberry 2 - 4 and Pine64, RockPro64.

of all current I try and sussess at last got what I wanted is with Raspberry pi 4

 

pi2-3 are too week doing software decoding in real time at all when it comes with HD and higher

if you matrial is only 640x480 then it good for. 

 

RockPro64 have to bad kernel support of gpu and video decoding so it got simluare problem as pi2-3 even it got more powerfull cpu, but in most time it can do full hd transcoding, if only audio need be transcoding. 

 

Pine64 is second best of all these it got opensource h264 hw decoding that works from native linux kernel but it got problem with h264 10-bit matrial and 4k transcoding

 

Pi 4 is only one that does not have problem with 10-bit matrial after you got hw encdoing working choice openMax H.264, the cpu core will drop from 100% to 60-70% :) and u can still use the desktop same time.  

 

 

 

>>>>>> Affected codecs

Encoder OpenMax H.264

Profiles: Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6)

 

 

>>>>>> FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: Custom

Info Checking: 'OpenMax H.264'

Info Check successful - selecting 'OpenMax H.264'

 

>>>>>> FindVideoDecoder - MediaType: hevc, Mode: Custom

Info Checking: 'Automatic software decoder'

Info Check successful - selecting 'Automatic software decoder'

 

>>>>> Legacy Command

 

/opt/emby-server/bin/ffmpeg -ss 00:01:48.000 -f matroska -i file:"*********.mkv" -threads 0 -map 0:0 -map 0:1 -c:v:0 h264_omx -copyts -filter_complex "[0:3]scale=1280:720:force_original_aspect_ratio=decrease;[0:0]overlay=(W-w)/2:(H-h):repeatlast=0" -b:v:0 1922574 -maxrate 1922574 -bufsize 3845148 -profile:v:0 high -level:v:0 41 -g:v:0 72 -keyint_min:v:0 72 -sc_threshold:v:0 0 -vsync -1 -codec:a:0 ac3 -metadata:s:a:0 language=eng -disposition:a:0 default -ac:a:0 6 -ab:a:0 384000 -ar:a:0 48000 -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_write_temp 1 -segment_list_type m3u8 -segment_start_number 36 -segment_list "/media/usb/linux/emby/transcoding/transcoding-temp/E12C39.m3u8" -y "/media/usb/linux/emby/transcoding/transcoding-temp/E12C39_%d.ts"

Edited by GreatLord
  • Like 1
Link to comment
Share on other sites

GreatLord
Hi Luke 

is it posible see if you guys can use Raspberry Pi offical hardware decding of h264 and h265 when it need doing transcoding ?
Link to comment
Share on other sites

 

Hi Luke 
is it posible see if you guys can use Raspberry Pi offical hardware decding of h264 and h265 when it need doing transcoding ?

 

 

ffmpeg supports OpenMax encoding but not decoding.

 

Could you please provide a full ffmpeg log showing the hw accelerated encoding?

 

 

Regarding RockPro64: You say you got it working. Could you show an ffmpeg log?

 

Thanks

Link to comment
Share on other sites

GreatLord

Hi Sorry for late response I am not home until middle of this week to access the log of raspberry pi4

 

The rockpro64 I can get hw decoding work but it is not worth the process doing it, it need older version of linux kernel special version from rockchip it self and manual compile stuff it is a process I will not go into detail get it work it is not strengt full process, I was also force write smaller patcher my self (true hack) and i will not release thuse patcher either, they will never be accpect in upstrem of linux kernel so i did move back to  using software decding and encding of it. and that is I wrote about. 

Ok thanks the info that OpenMax only support hw encoding I will try the other hw acclartion as well this weekend and give full log of both 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
studio-jurdan
On 5/29/2020 at 9:25 PM, GreatLord said:
Hi Luke 

 

is it posible see if you guys can use Raspberry Pi offical hardware decding of h264 and h265 when it need doing transcoding ?

 

Hello, i'm installing emby on OMV docker with pi4 but this second install don't have emby encoding hardware.  i thing something iss missing in the instal. must i install ffmpeg separatly?  can you explane how to install emby and working for encoding?

Link to comment
Share on other sites

GreatLord

Hi

I did use raspbery offical os and the hardware decdoing is working out of the box from raspberrypi.org.
But I have stop using onechip computer as media server, I did build new one with amd ryzen 5 3400G,
it was best solv for me after so many year trying build perfect media server with cheap micro computer.

 

EDIT BY softworkz: GreatLord forgot to mention that he has NOT been using Docker.

 

Edited by softworkz
Link to comment
Share on other sites

1 hour ago, GreatLord said:

Hi

I did use raspbery offical os and the hardware decdoing is working out of the box from raspberrypi.org.
But I have stop using onechip computer as media server, I did build new one with amd ryzen 5 3400G,
it was best solv for me after so many year trying build perfect media server with cheap micro computer.

Sounds nice...

would you be able to post a complete ffmpeg log from a hw transcoding session?

Edited by softworkz
Link to comment
Share on other sites

On 8/2/2020 at 9:20 PM, studio-jurdan said:

Hello, i'm installing emby on OMV docker with pi4 but this second install don't have emby encoding hardware.  i thing something iss missing in the instal. must i install ffmpeg separatly?  can you explane how to install emby and working for encoding?

 

13 hours ago, Luke said:

How did you configure the docker container?

To my knowledge, there doesn't exist any confirmed Emby setup on the RPI where Emby is running inside a Docker container while being able to use video hw acceleration.

The solution would be to install Emby directly on the RPI, not inside a Docker container.

Link to comment
Share on other sites

  • 4 weeks later...
On 8/6/2020 at 5:09 AM, softworkz said:

 

To my knowledge, there doesn't exist any confirmed Emby setup on the RPI where Emby is running inside a Docker container while being able to use video hw acceleration.

The solution would be to install Emby directly on the RPI, not inside a Docker container.

This image works fine on rpi4 with hwa enabled: https://docs.linuxserver.io/images/docker-emby

Link to comment
Share on other sites

  • 2 months later...

on a Pi4 8G running Home-Assistant with emby running in a docker container - the source image is here linuxserver/emby - LinuxServer.io

 

the HWA only works for encoding. In the example attached the source is a HEVC transcoded into MP4.

 

2020-11-23 17:13:28.654
Operating System: Linux version 5.4.72-v7l+ (dom@buildbot) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #1356 SMP Thu Oct 22 13:57:51 BST 2020
OS/Process: arm/arm
Emby Server version: 4.5.1.0
Operating system: Unix 5.4.72.7
Command Line: /app/emby/EmbyServer.dll -programdata /config -ffdetect /app/emby/ffdetect -ffmpeg /app/emby/ffmpeg -ffprobe /app/emby/ffprobe -restartexitcode 3
 
 
App: Emby Web 4.5.1.0
Firefox
 
 
http://###########:8096/emby/videos/21828/hls1/main/0.ts?DeviceId=bc2e9cc4-49d4-4cdd-a480-0d7cd6e8eedf&MediaSourceId=5f1a55251708ab9aaabe27ca5fd4e984&PlaySessionId=3f57ec7f827d415b879ac23d9d7ca695&api_key=4d9ea9b7ee4645ac956b4e28cb61a17d&VideoCodec=h264&AudioCodec=aac&VideoBitrate=139616000&AudioBitrate=384000&AudioStreamIndex=1&SubtitleStreamIndex=2&SubtitleMethod=Hls&TranscodingMaxAudioChannels=2&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&ManifestSubtitles=vtt&h264-profile=high,main,baseline,constrainedbaseline&h264-level=52&TranscodeReasons=SubtitleCodecNotSupported
 
 
{"Protocol":"File","Id":"5f1a55251708ab9aaabe27ca5fd4e984","Path":"/mnt/share1/VIDEOS/Series/###################################.mkv","Type":"Default","Container":"mkv","Size":981064690,"Name":"##################################","IsRemote":false,"RunTimeTicks":22258560000,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"hevc","TimeBase":"1/1000","CodecTimeBase":"1001/24000","VideoRange":"SDR","DisplayTitle":"1080p HEVC","IsInterlaced":false,"BitRate":3526067,"BitDepth":10,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":808,"Width":1920,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":"Main 10","Type":"Video","AspectRatio":"240:101","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","PixelFormat":"yuv420p10le","Level":120,"IsAnamorphic":false},{"Codec":"eac3","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1/48000","DisplayTitle":"English EAC3 6 ch","DisplayLanguage":"English","IsInterlaced":false,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File"},{"Codec":"subrip","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"0/1","Title":"English","DisplayTitle":"English (SUBRIP)","DisplayLanguage":"English","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":2,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Protocol":"File"},{"Codec":"subrip","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"0/1","Title":"English [SDH]","DisplayTitle":"English (SUBRIP)","DisplayLanguage":"English","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":3,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Protocol":"File"}],"Formats":[],"Bitrate":3526067,"RequiredHttpHeaders":{},"ReadAtNativeFramerate":false}
 
 
>>>>>> User policy for waltre
EnablePlaybackRemuxing: True
EnableVideoPlaybackTranscoding: True
EnableAudioPlaybackTranscoding: True
 
 
>>>>>> Affected codecs
Encoder OpenMax H.264
Profiles: Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6)
 
 
 
 
>>>>>> FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: Custom
Info Checking: 'OpenMax H.264'
Info Check successful - selecting 'OpenMax H.264'
 
 
>>>>>> FindVideoDecoder - MediaType: hevc, Mode: Custom
Info Checking: 'Automatic software decoder'
Info Check successful - selecting 'Automatic software decoder'
 
 
/app/emby/ffmpeg -loglevel +timing -y -print_graphs_file "/config/logs/ffmpeg-transcode-1f3e6563-3df1-4085-b575-8e363603d561_1graph.txt" -copyts -start_at_zero -f matroska,webm -c:v:0 hevc -i "/mnt/share1/#######################################################.mkv" -map 0:0 -map 0:1 -sn -c:v:0 h264_omx -b:v:0 7052134 -g:v:0 72 -maxrate:v:0 7052134 -bufsize:v:0 14104268 -sc_threshold:v:0 0 -profile:v:0 100 -keyint_min:v:0 72 -c:a:0 aac -ab:a:0 192000 -ac:a:0 2 -metadata:s:a:0 language=eng -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/config/transcoding-temp/52387E.m3u8" -segment_list_type m3u8 -segment_time 3 -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/config/transcoding-temp/52387E_%d.ts" -map 0:2 -map 0:0 -an -c:v:0 copy -c:s:0 webvtt -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format webvtt -segment_list "/config/transcoding-temp/52387E_s2.m3u8" -segment_list_type m3u8 -segment_time 3 -segment_start_number 0 -break_non_keyframes 1 -individual_header_trailer 1 -write_header_trailer 0 -write_empty_segments 1 -segment_write_temp 1 -min_frame_time 00:00:00.000 "/config/transcoding-temp/52387E_s2_%d.vtt" -map 0:3 -map 0:0 -an -c:v:0 copy -c:s:0 webvtt -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format webvtt -segment_list "/config/transcoding-temp/52387E_s3.m3u8" -segment_list_type m3u8 -segment_time 3 -segment_start_number 0 -break_non_keyframes 1 -individual_header_trailer 1 -write_header_trailer 0 -write_empty_segments 1 -segment_write_temp 1 -min_frame_time 00:00:00.000 "/config/transcoding-temp/52387E_s3_%d.vtt"
 

 

 

Edited by waltre
Link to comment
Share on other sites

On 11/23/2020 at 6:24 PM, waltre said:

the HWA only works for encoding.

Yes, that's expected. Could you please post the full log (as attachment)? That would be great!
(or send it to me via PM)

Link to comment
Share on other sites

@waltre - Thanks a lot for sending the log file! As I do not have an RPI at the moment, it's great to have a more recent example.

The performance is not that great - even below realtime, so I suppose it doesn't play fluently?

Probably this is due to the required bit-depth conversion  (10 to 8 bit). An 8  bit HEVC or H264 video will probably transcode at >1.0x speed.

Link to comment
Share on other sites

  • 1 month later...
miauriel
On 24/11/2020 at 19:49, softworkz said:

@waltre - Thanks a lot for sending the log file! As I do not have an RPI at the moment, it's great to have a more recent example.

The performance is not that great - even below realtime, so I suppose it doesn't play fluently?

Probably this is due to the required bit-depth conversion  (10 to 8 bit). An 8  bit HEVC or H264 video will probably transcode at >1.0x speed.

I have an 8gb rpi4, with a geeekpi ice cooling tower and an ssd to run the os out of. It is running OMV5 on top of PiOS with all services via docker. This weekend I'll be doing a fresh install which will include over clocking, but I want to get the hardware acceleration done correctly. Could you please point me to the best source and/or clearest guide regarding this matter? I'll be writing a how-to for my whole process which I can link been here. Also, what type of logs can be of best assistance for your team?

Thanks!

Link to comment
Share on other sites

6 minutes ago, miauriel said:

I have an 8gb rpi4, with a geeekpi ice cooling tower and an ssd to run the os out of. It is running OMV5 on top of PiOS with all services via docker. This weekend I'll be doing a fresh install which will include over clocking, but I want to get the hardware acceleration done correctly. Could you please point me to the best source and/or clearest guide regarding this matter? I'll be writing a how-to for my whole process which I can link been here. Also, what type of logs can be of best assistance for your team?

Thanks!

Hi, our general hardware acceleration guide can be found here:

https://support.emby.media/support/solutions/articles/44001160148-hardware-acceleration-overview

There currently is not much information in there for Docker though. For the most part that is community contributed here in the forum.

Link to comment
Share on other sites

miauriel
14 hours ago, Luke said:

Hi, our general hardware acceleration guide can be found here:

https://support.emby.media/support/solutions/articles/44001160148-hardware-acceleration-overview

There currently is not much information in there for Docker though. For the most part that is community contributed here in the forum.

Yes I saw that. That's one reason I'm trying to get this of together. I want to get a solid how to to help those running both emby and jellyfin. What about logs? I want to put a line in the how-to to indicate what logs have to be monitored so devs can be fed data to better develop the software.

Edited by miauriel
forgot to ask about logs
Link to comment
Share on other sites

@miauriel, if it's not being detected, then the emby server and hardware detection logs are needed to diagnose.

If it is being detected but there's a problem using it, then the emby server log, hardware detection log, and an ffmpeg transcoding log example are needed. Does that answer your question?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...