Jump to content

Ubuntu/ Vaapi/ AMD WX5100: disable B-Frames?


labor4

Recommended Posts

labor4

Hi Community

 

Is there a way to disable B-Frames in h264 enc/transcode?

It seems setting "-bf 0" seems to let me encode via GPU. At least in a rough CLI try.

It fails via Emby.

 

Thanks

{"Protocol":"File","Id":"4fb277e82f3f9ea97cf20c2d657c6861","Path":"/media/moviedisk/base/seafile/EMBY_basevidrepo/coxwil/20190412/Empty Shelf.5b.COLOR.mov.mp4","Type":"Default","Container":"mp4","Size":681017367,"Name":"Empty Shelf.5b.COLOR.mov","IsRemote":false,"RunTimeTicks":2688800000,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"h264","CodecTag":"avc1","Language":"und","ColorTransfer":"bt709","ColorPrimaries":"bt709","ColorSpace":"bt709","TimeBase":"1/12800","CodecTimeBase":"1/50","VideoRange":"SDR","DisplayTitle":"1080p H264","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":20064211,"BitDepth":8,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":1080,"Width":1920,"AverageFrameRate":25,"RealFrameRate":25,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":41,"IsAnamorphic":false},{"Codec":"aac","CodecTag":"mp4a","Language":"und","TimeBase":"1/48000","CodecTimeBase":"1/48000","DisplayTitle":"Und AAC stereo (Default)","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":192000,"Channels":2,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Profile":"LC","Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0}],"Formats":[],"Bitrate":20262343,"RequiredHttpHeaders":{},"ReadAtNativeFramerate":false}

User policy for admin: EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True

Affected codecs:
>>>>>>  VAAPI Ellesmere [Radeon Pro - H.264 (AVC)
        Adapter #0: 'Ellesmere [Radeon Pro' Id:26567 (Driver: Mesa Gallium driver 18.2.0-rc3 for AMD Radeon (TM) Pro WX 5100 Graphics (POLARIS10, DRM 3.27.0, 4.15.0-47-generic, LLVM 7.0.1), Vendor: Advanced Micro Devices, Inc. [AMD/ATI])
        Frame Sizes: max 4096x4096
        Color Formats: NV12
        Profiles: Constrained Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6)

>>>>>>  VAAPI Ellesmere [Radeon Pro - H.264 (AVC)
        Adapter #0: 'Ellesmere [Radeon Pro' Id:26567 (Driver: Mesa Gallium driver 18.2.0-rc3 for AMD Radeon (TM) Pro WX 5100 Graphics (POLARIS10, DRM 3.27.0, 4.15.0-47-generic, LLVM 7.0.1), Vendor: Advanced Micro Devices, Inc. [AMD/ATI])
        Frame Sizes: max 4096x2304
        Color Formats: NV12, P010
        Profiles: Constrained Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6)


>>>>>>  FindVideoDecoder - MediaType: h264, Mode: 2
Info    FindVideoDecoder - Checking: 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)' (Priority: 100)
Info    FindVideoDecoder - Check successful - selecting 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)'

>>>>>>  FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: 2
Info    FindVideoEncoder - Checking: 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)' (Priority: 100)
Info    Encoder supports input stream
Info    FindVideoEncoder - Check successful - selecting 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)'

>>>>>>  FindVideoDecoder - MediaType: h264, Mode: 2
Info    FindVideoDecoder - Checking: 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)' (Priority: 100)
Info    FindVideoDecoder - Check successful - selecting 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)'

>>>>>>  FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: 2
Info    FindVideoEncoder - Checking: 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)' (Priority: 100)
Info    Encoder supports input stream
Info    FindVideoEncoder - Check successful - selecting 'VAAPI Ellesmere [Radeon Pro - H.264 (AVC)'

/opt/emby-server/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -f mp4 -i file:"/media/moviedisk/base/seafile/EMBY_basevidrepo/coxwil/20190412/Empty Shelf.5b.COLOR.mov.mp4" -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 h264_vaapi -filter_complex "[0:0]scale_vaapi=w=1280:h=720"  -b:v:0 3808002 -maxrate 3808002 -bufsize 7616004 -profile:v:0 high -level:v:0 4.1 -g:v:0 75 -keyint_min:v:0 75 -sc_threshold:v:0 0  -copyts -vsync -1 -codec:a:0 copy -disposition:a:0 default -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 0 -segment_list "/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f.m3u8" -y "/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f%d.ts"

ffmpeg version 4.0.3-emby_2019_03_26 Copyright (c) 2000-2018 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 6.3.0 (crosstool-NG crosstool-ng-1.23.0)
Local Time: 20:46:02
T=0.000s
T=0.008s
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/media/moviedisk/base/seafile/EMBY_basevidrepo/coxwil/20190412/Empty Shelf.5b.COLOR.mov.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.27.102
  Duration: 00:04:28.88, start: 0.000000, bitrate: 20262 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 20064 kb/s, Level 41, 25 fps, 25 tbr, 12800 tbn, 25600 tbc (default)
    Metadata:
      handler_name    : Core Media Video
      timecode        : 01:00:00:00
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : Core Media Video
      timecode        : 01:00:00:00
T=0.026s
T=0.027s
    Last message repeated 1 times
T=0.047s
Stream mapping:
  Stream #0:0 (h264) -> scale_vaapi
  scale_vaapi -> Stream #0:0 (h264_vaapi)
  Stream #0:1 -> #0:1 (copy)
T=0.047s
Press [q] to stop, [?] for help
[h264_vaapi @ 0x9da080] B frames are not supported (0x1) by the underlying driver.
[h264_vaapi @ 0x9da080] Warning: some packed headers are not supported (want 0xd, got 0).
[segment @ 0x9d2c00] Opening '/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f0.ts.tmp' for writing
Output #0, segment, to '/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f%d.ts':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (h264_vaapi) (High), vaapi_vld, 1280x720 [SAR 1:1 DAR 16:9], q=0-31, 3808 kb/s, Level 41, 25 fps, 90k tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.18.100 h264_vaapi
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
elapsed=00:00:00.50 frame=   39 fps=0.0 q=-0.0 size=     847kB time=00:00:01.81 bitrate=3827.4kbits/s throttle=off speed=3.62x    
[segment @ 0x9d2c00] Opening '/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f.m3u8.tmp' for writing
SegmentComplete=video:0 Index=0 Start=0.000000 End=3.000000 Duration=3.000000 offset_pts=0 start_pts=0 Frames=75 filename=09df8d857682e7d94b6727ae7ba72d1f0.ts
[segment @ 0x9d2c00] Opening '/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f1.ts.tmp' for writing
elapsed=00:00:01.00 frame=   80 fps= 80 q=-0.0 size=    1755kB time=00:00:03.45 bitrate=4159.5kbits/s throttle=off speed=3.43x    
elapsed=00:00:01.50 frame=  133 fps= 88 q=-0.0 size=    2393kB time=00:00:05.56 bitrate=3520.5kbits/s throttle=off speed=3.69x    
[segment @ 0x9d2c00] Opening '/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f.m3u8.tmp' for writing
SegmentComplete=video:0 Index=1 Start=3.000000 End=6.000000 Duration=3.000000 offset_pts=0 start_pts=3000000 Frames=75 filename=09df8d857682e7d94b6727ae7ba72d1f1.ts
[segment @ 0x9d2c00] Opening '/media/moviedisk/transcoding-temp/transcoding-temp/09df8d857682e7d94b6727ae7ba72d1f2.ts.tmp' for writing
elapsed=00:00:02.02 frame=  183 fps= 91 q=-0.0 size=    3522kB time=00:00:07.57 bitrate=3810.2kbits/s throttle=off speed=3.75x    
elapsed=00:00:02.58 frame=  203 fps= 78 q=-0.0 size=    4012kB time=00:00:08.36 bitrate=3930.2kbits/s throttle=off speed=3.23x    
elapsed=00:00:03.09 frame=  223 fps= 72 q=-0.0 size=    4458kB time=00:00:09.17 bitrate=3980.9kbits/s throttle=off speed=2.97x    

Link to comment
Share on other sites

labor4

5cbb75825fe9e_Bildschirmfoto20190420um21

 

Chrome 73.0.3683.103

Emby 4.2.0.0 beta

Linux emby 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Edited by labor4
Link to comment
Share on other sites

 

Hi Community

 

Is there a way to disable B-Frames in h264 enc/transcode?

It seems setting "-bf 0" seems to let me encode via GPU. At least in a rough CLI try.

It fails via Emby.

 

From your logs, I can't see that it "fails via Emby". 

Of course, there's that warning in the log, but then it proceeds to transcode just normally.

 

So I don't quite understand your conclusion " setting "-bf 0" seems to let me encode via GPU

 

What you could do is to create a few segments using both ways (Emby original command line and yours adding '-bf 0'), then we could analyze the resulting segments.

 

Another thing to try: Press F12 in the browser before playback and switch to the 'Console' tab to look for an error.

Link to comment
Share on other sites

labor4

I think you're right and my assumption was probably wrong, since it encoded anyway.

I felt strengthened in that opinion since I extracted the command and ffmpeg didn't let me pass this problem without the option.

But you guys have probably solved this differently, I guess.

 

Attached is my chrome console.

There are errors. It starts at line 2.

 

I cannot say much, other than line 1 is the moment after I pressed play.

 

Thanks a lot for looking into this!

 

best,

manu

 

Ps: Still Version 4.2.0.0 beta, on macos with chrome Version 74.0.3729.108

chrome_console.txt

Edited by labor4
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...