Jump to content
Sign in to follow this  
tdiguy

RPI specific request.

Recommended Posts

tdiguy

I will preface this with i do not know how much of a difference this would make.

 

I am thinking that if there was support for mpeg2 hardware accelerated decoding via mmal that it might make for smoother live tv watching for the rpi. I am thinking that with hardware accelerated support for mp4's and mpeg2 that it might make the rpi into quite the media server.

 

I can furnish access to my rpi if you do not already have one for testing with a mpeg2 license installed.

 

Share this post


Link to post
Share on other sites
Luke

If you can find the necessary ffmpeg command line changes then we can integrate them.

Share this post


Link to post
Share on other sites
tdiguy

I am having a hell of a time finding an example of a command to use with ffmpeg to use it. configuring ffmpeg to have it was  --enable-decoder=mpeg2_mmal if that helps at all.

Share this post


Link to post
Share on other sites
Luke

That will get it compiled in. The next thing will be to actually use it.

Share this post


Link to post
Share on other sites
tdiguy

I can see why this is not exactly an easy task.

 

I have been trying to poke around with the help commands in ffmpeg because web searches seem to constantly lead me to articles about mp4 acceleration.

 

This is the output of my codecs for mpeg2 the mpegvideo_vdpau and mpeg2_v412m2m do not work at all i suspect i dont have the right hardware.

pi@raspberrypi:/media/emby/ffmpeg-stuff/FFmpeg $ ./ffmpeg -codecs | grep mpeg2
ffmpeg version git-2017-09-30-148c8e8 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
  configuration: --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfdk-aac --enable-libvpx --enable-libopus --enable-librtmp --enable-libmp3lame --enable-gpl --enable-omx --enable-omx-rpi --enable-version3 --enable-decoder=mpeg2_mmal
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.100 /  6.106.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
 DEV.L. mpeg2video           MPEG-2 video (decoders: mpeg2video mpegvideo mpegvideo_vdpau mpeg2_v4l2m2m ) (encoders: mpeg2video mpeg2_vaapi )

I have no idea if there is a difference between mpeg2video and mpegvideo but the performance seem similar to me. 

Edited by tdiguy

Share this post


Link to post
Share on other sites
tdiguy

aha, i think i figured out what my major headache was. Even though i had the --enable-decoder=mpeg2_mmal switch in there the first time i did not know to also include --enable-mmal. My latest config is: 

sudo ./configure --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfdk-aac --enable-libvpx --enable-libopus --enable-librtmp --enable-libmp3lame --enable-gpl --enable-omx --enable-omx-rpi --enable-version3 --enable-decoder=mpeg2_mmal --enable-mmal

 

Now my output for decoders is:

pi@raspberrypi:/media/emby/ffmpeg-stuff/FFmpeg $ ./ffmpeg -decoders | grep mpeg2                                                 ffmpeg version git-2017-09-30-148c8e8 Copyright © 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
  configuration: --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfdk-aac --enable-libvpx --enable-libopus --enable-librtmp --enable-libmp3lame --enable-gpl --enable-omx --enable-omx-rpi --enable-version3 --enable-decoder=mpeg2_mmal --enable-mmal
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.100 /  6.106.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
 V.S.BD mpeg2video           MPEG-2 video
 V.S.BD mpegvideo            MPEG-1 video (codec mpeg2video)
 V....D mpegvideo_vdpau      MPEG-1/2 video (VDPAU acceleration) (codec mpeg2video)
 V..... mpeg2_mmal           mpeg2 (mmal) (codec mpeg2video)
 V..... mpeg2_v4l2m2m        V4L2 mem2mem MPEG2 decoder wrapper (codec mpeg2video)
 
pi@raspberrypi:/media/emby/ffmpeg-stuff/FFmpeg $ sudo ./ffmpeg -codec:v mpeg2_mmal -i The\ Big\ Bang\ Theory\ S11E02\ The\ Retraction\ Reaction-1.ts -codec:v0 h264_omx out.mp4
ffmpeg version git-2017-09-30-148c8e8 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
  configuration: --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfdk-aac --enable-libvpx --enable-libopus --enable-librtmp --enable-libmp3lame --enable-gpl --enable-omx --enable-omx-rpi --enable-version3 --enable-decoder=mpeg2_mmal --enable-mmal
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.100 /  6.106.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[mpegts @ 0x24fbec0] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from 'The Big Bang Theory S11E02 The Retraction Reaction-1.ts':
  Duration: 00:32:00.26, start: 56540.601733, bitrate: 2683 kb/s
  Program 131
    Stream #0:0[0x8c0]: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p(top first), 320x240, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x8c1](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x8c2](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
File 'out.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (mpeg2_mmal) -> h264 (h264_omx))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[mpeg2_mmal @ 0x2502790] Changing output format.577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A
[h264_omx @ 0x26927c0] Using OMX.broadcom.video_encode
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf57.82.102
    Stream #0:0: Video: h264 (h264_omx) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.106.104 h264_omx
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1(side), fltp, 341 kb/s
    Metadata:
      encoder         : Lavc57.106.104 aac
frame=  663 fps= 32 q=-0.0 Lsize=    1490kB time=00:00:22.08 bitrate= 552.5kbits/s dup=157 drop=0 speed=1.08x
video:566kB audio:904kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.379352%

I am not really sure if i am using the right commands with ffmpeg i am pretty much a newb at this. The speed isnt crazy but i imagine it might be smoother i think seeing the mpeg2_mmal in that teal ( I am partially color blind also btw ) color means its hardware.
The differance between  sudo ./ffmpeg -codec:v mpeg2_mmal -i The\ Big\ Bang\ Theory\ S11E02\ The\ Retraction\ Reaction-1.ts -codec:v0 h264_omx out.mp4
and sudo ./ffmpeg -codec:v mpeg2video -i The\ Big\ Bang\ Theory\ S11E02\ The\ Retraction\ Reaction-1.ts -codec:v0 h264_omx out.mp4
seems to be somewhere between 10 and 20% cpu usage.
Course i think my commands are also a total hack job. Anyway hope this helps and that this is what you were looking for.
Edited by tdiguy

Share this post


Link to post
Share on other sites
Luke

Ok in emby you can already enable the omx option. it won't currently use mpeg2_mmal but we can add that for the next release. thanks,.

Share this post


Link to post
Share on other sites
tdiguy

Thank you very much. If you can make it user selectable that would be great, since to enable it a licence must be bought from rpi. Also curious, would the mmal decoder help with live streaming from the tv tuner?

Share this post


Link to post
Share on other sites
Luke

Try it and report your experience.

  • Like 1

Share this post


Link to post
Share on other sites
tdiguy

Actually the output looks really similar to what i was doing with my testing, its taking a mpeg2 and then encoding it with (h264_omx) 

I will have to give this a try when i get home. Work would not appreciate me streaming anything to my desktop.

I am assuming i would have to start watching a live channel, look in the log for the file / location then substitute that with the input and make nearly anything the outputfile.mp4  I dont think i would get to watch the output but i would be able to at least see the fps and the speed.

Share this post


Link to post
Share on other sites
tdiguy

Very cool i see it is already in the new beta. I will have to try it out when i get home. Already updated my server to the new version.

Share this post


Link to post
Share on other sites
Luke

@@tdiguy

The upcoming Emby Server 4.2 will have h264_omx built-in for Raspberry Pi hardware encoding. Thanks guys.

  • Like 1

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...