Jump to content

h264_omx instead of x264


awiouy

Recommended Posts

side note:

even in tests outside Emby.. I see that the console output is different.

the OMX version has no summary

while the non-OMX version displays some sort of activity summary at the end of the Encoding process.

 

No idea how that affects your code...if at all.

 

You can see the "broken" process call stops at the stream mappings... then quits.

While the "valid" run on the same file has the encoding progress log.

 

OMX Output:

[h264_omx @ 0x3321740] Using OMX.broadcom.video_encode
Output #0, mp4, to 'test-omx.mp4':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Video: h264 (h264_omx) ([33][0][0][0] / 0x0021), yuv420p, 704x480 [SAR 10:11 DAR 4:3], q=2-31, 1500 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      BPS             : 979595
      BPS-eng         : 979595
      DURATION        : 00:00:41.708000000
      DURATION-eng    : 00:00:41.708000000
      NUMBER_OF_FRAMES: 1250
      NUMBER_OF_FRAMES-eng: 1250
      NUMBER_OF_BYTES : 5107120
      NUMBER_OF_BYTES-eng: 5107120
      _STATISTICS_WRITING_APP: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-02-09 17:45:19
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-02-09 17:45:19
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc57.93.100 h264_omx
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp (default)
    Metadata:
      BPS             : 86457
      BPS-eng         : 86457
      DURATION        : 00:00:41.706000000
      DURATION-eng    : 00:00:41.706000000
      NUMBER_OF_FRAMES: 1955
      NUMBER_OF_FRAMES-eng: 1955
      NUMBER_OF_BYTES : 450726
      NUMBER_OF_BYTES-eng: 450726
      _STATISTICS_WRITING_APP: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-02-09 17:45:19
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-02-09 17:45:19
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
frame= 1250 fps= 61 q=-0.0 Lsize=    8390kB time=00:00:41.70 bitrate=1648.1kbits/s speed=2.02x
video:7906kB audio:440kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.527222%

non-OMX output:


ffmpeg version N-85641-gdd49eff Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --enable-gpl --enable-nonfree --enable-mmal --enable-omx --enable-omx-rpi --enable-libmp3lame --enable-libx264 --enable-libvorbis
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 86.100 /  6. 86.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, matroska,webm, from '../Sample.mkv':
  Metadata:
    encoder         : libebml v1.3.1 + libmatroska v1.4.2
    creation_time   : 2016-02-09T17:45:19.000000Z
  Duration: 00:00:41.73, start: 0.000000, bitrate: 1069 kb/s
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 704x480 [SAR 38052:3505 DAR 279048:17525], SAR 10:11 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 29.97 tbc (default)
    Metadata:
      BPS             : 979595
      BPS-eng         : 979595
      DURATION        : 00:00:41.708000000
      DURATION-eng    : 00:00:41.708000000
      NUMBER_OF_FRAMES: 1250
      NUMBER_OF_FRAMES-eng: 1250
      NUMBER_OF_BYTES : 5107120
      NUMBER_OF_BYTES-eng: 5107120
      _STATISTICS_WRITING_APP: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-02-09 17:45:19
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-02-09 17:45:19
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      BPS             : 86457
      BPS-eng         : 86457
      DURATION        : 00:00:41.706000000
      DURATION-eng    : 00:00:41.706000000
      NUMBER_OF_FRAMES: 1955
      NUMBER_OF_FRAMES-eng: 1955
      NUMBER_OF_BYTES : 450726
      NUMBER_OF_BYTES-eng: 450726
      _STATISTICS_WRITING_APP: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-02-09 17:45:19
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-02-09 17:45:19
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x329c740] using SAR=10/11
[libx264 @ 0x329c740] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x329c740] profile High, level 3.0
[libx264 @ 0x329c740] 264 - core 142 r2431 a5831aa - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=1500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test-264.mp4':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 704x480 [SAR 10:11 DAR 4:3], q=-1--1, 1500 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      BPS             : 979595
      BPS-eng         : 979595
      DURATION        : 00:00:41.708000000
      DURATION-eng    : 00:00:41.708000000
      NUMBER_OF_FRAMES: 1250
      NUMBER_OF_FRAMES-eng: 1250
      NUMBER_OF_BYTES : 5107120
      NUMBER_OF_BYTES-eng: 5107120
      _STATISTICS_WRITING_APP: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-02-09 17:45:19
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-02-09 17:45:19
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc57.93.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/1500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp (default)
    Metadata:
      BPS             : 86457
      BPS-eng         : 86457
      DURATION        : 00:00:41.706000000
      DURATION-eng    : 00:00:41.706000000
      NUMBER_OF_FRAMES: 1955
      NUMBER_OF_FRAMES-eng: 1955
      NUMBER_OF_BYTES : 450726
      NUMBER_OF_BYTES-eng: 450726
      _STATISTICS_WRITING_APP: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.2.0 ('World of Adventure') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-02-09 17:45:19
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-02-09 17:45:19
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
frame= 1250 fps= 11 q=-1.0 Lsize=    9303kB time=00:00:41.70 bitrate=1827.5kbits/s speed=0.355x
video:8813kB audio:440kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.544319%
[libx264 @ 0x329c740] frame I:23    Avg QP:14.82  size: 44723
[libx264 @ 0x329c740] frame P:737   Avg QP:21.93  size:  9476
[libx264 @ 0x329c740] frame B:490   Avg QP:21.17  size:  2063
[libx264 @ 0x329c740] consecutive B-frames: 42.0% 15.4%  5.5% 37.1%
[libx264 @ 0x329c740] mb I  I16..4: 14.7% 46.1% 39.3%
[libx264 @ 0x329c740] mb P  I16..4:  1.8% 10.4%  4.5%  P16..4: 31.9%  9.6%  5.1%  0.0%  0.0%    skip:36.6%
[libx264 @ 0x329c740] mb B  I16..4:  0.2%  0.6%  0.7%  B16..8: 24.3%  2.3%  0.7%  direct: 0.9%  skip:70.2%  L0:39.5% L1:57.0% BI: 3.5%
[libx264 @ 0x329c740] final ratefactor: 20.22
[libx264 @ 0x329c740] 8x8 transform intra:58.9% inter:64.6%
[libx264 @ 0x329c740] coded y,uvDC,uvAC intra: 67.6% 78.5% 54.1% inter: 14.1% 19.2% 4.5%
[libx264 @ 0x329c740] i16 v,h,dc,p: 37% 35% 13% 14%
[libx264 @ 0x329c740] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 24% 19%  5%  8%  5% 11%  5%  8%
[libx264 @ 0x329c740] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 16%  5%  8%  6%  9%  4%  5%
[libx264 @ 0x329c740] i8c dc,h,v,p: 43% 30% 20%  7%
[libx264 @ 0x329c740] Weighted P-Frames: Y:1.5% UV:1.2%
[libx264 @ 0x329c740] ref P L0: 77.2% 14.1%  6.3%  2.4%  0.0%
[libx264 @ 0x329c740] ref B L0: 91.9%  7.5%  0.6%
[libx264 @ 0x329c740] ref B L1: 96.2%  3.8%
[libx264 @ 0x329c740] kb/s:1730.79

real    1m58.259s
user    5m15.740s
sys     0m3.210s

Edited by cachaca
Link to post
Share on other sites

Yea we'll have to learn what aspect of our command line OMX doesn't like or is having trouble with.

Link to post
Share on other sites

so.. do you think it is a wise course of action to experiment with these 2 lines?

 

WITHOUT OMX:

 

/home/pi/ffmpeg/ffmpeg -f matroska -codec:0 hevc -codec:1 aac -i file:"/media/usb0/TV Shows/SpongeBob SquarePants (1999-2015) [480p] [720p] [HEVC] [x265]/Season 01/[pseudo] S01E02 Reef Blower [480p] [h.265].mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -pix_fmt yuv420p -preset superfast -crf 28 -maxrate 2211644 -bufsize 4423288 -profile:v high -level 4.1 -x264opts:0 subme=0:rc_lookahead=10:me_range=4:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:gte(t,n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 aac -strict experimental -ac 2 -ab 192000  -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3  -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/var/lib/emby-server/transcoding-temp/9de4642f1c380e2f7a6d25892e737ddb.m3u8" -y "/var/lib/emby-server/transcoding-temp/9de4642f1c380e2f7a6d25892e737ddb%d.ts"

 

 

WITH OMX:

/home/pi/ffmpeg/ffmpeg -i file:"/media/usb0/TV Shows/SpongeBob SquarePants (1999-2015) [480p] [720p] [HEVC] [x265]/Season 01/[pseudo] S01E01 Help Wanted [480p] [h.265].mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_omx  -b:v 1294648 -maxrate 1294648 -bufsize 2589296 -force_key_frames "expr:gte(t,n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 aac -strict experimental -ac 2 -ab 192000  -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3  -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/var/lib/emby-server/transcoding-temp/71a39803f8b49ed4d59c41d75afca3d1.m3u8" -y "/var/lib/emby-server/transcoding-temp/71a39803f8b49ed4d59c41d75afca3d1%d.ts"

 

till something works?

 

There are a few parameters I dont understand.

Is there basic documentation on the parameters emby needs? (vs what is printed above)

Link to post
Share on other sites

ok.. made a small breakthrough.. when I run it manually.. it WORKS if I quickly copy/paste and run as root in the shell

 

so.. it appears to be a permissions issue.. likely related to the library installation.

 

I never did install it.. I am just pointing to the path where I compiled the source.

 

Gonna try installing (even making a .deb package) and try again

Link to post
Share on other sites

To all those who still pursue this.. good luck...and be warned.  omx Requires root privileges.

 

I explain in a different thread:

https://emby.media/community/index.php?/topic/47066-need-help-troubleshooting-permissions-for-ffmpeg-raspberry-pi-omx/

 

I had decided to give Ubuntu MATE a try, since it contains pre-compiled ffmpeg binaries WITH omx support.

After another few hours of installation and configuration.. the Ubuntu deployed ffmpeg behaves EXACTLY the same way.
I mean. exactly.  Which validates the integrity of my personal Raspbian deployment (as it pertains to ffmpeg and its deplendencies)

I will move on without the OMX acceleration.  I wont turn this install upside down and run emby as root.. a media server connected to the Internet... all due respect to the developers of Emby.. and the many plugins I could use.. but I think the focus is on features.. not security.  Running it as "emby" limits the amount of damage a potential hacker may do.

Anyway. thank you for the help ... and let this be a warning to others.. it requires root.  ... and I suspect it is an undocumented requirement of the omx library subsection of the ffmpeg binary.

************
side note.. ubuntu 16LTS Mate is GARBAGE.  Absolute Garbage.  I have used beta distributions from smaller teams that installed and self configured with far less problems than this garbage distro.
I just turned it off.. without even shutting it down.  I will never use it again, and this MicroSD card will be wiped clean soon.

What is so bad about it?  I wont list all the problems.. and many config changes I had to do manually to a brand new system.. but here are the most glaring flaws:
- no swap file created or defined
- ssh would only start AFTER a successful login at the console... AND a graphical dialog box showed up (even though I used sudo at the prompt) asking me for a password
- vnc not installed by default.. and even after installed.. I had to manually configure X (tried 2 different vnc servers)
- and the crown jewel:
    -> first thing you do after getting a new distro: update the OS.  "sorry, you dont have enough disk space in /boot to perform your updates".  I had to do a NEW install, resizing the 64Meg boot partition to a larger size BEFORE installing the OS. (oh.. and because I resized partitions BEFORE the install, the INstaller did not extend the actual / partition to the rest of the SD card.. so the install failed again)

Not that I could not deal with these problems.. but seriously.. needing to log in at the console before ssh worked.. WTF  Was the Canonical guy on shrooms?  I had not used ubuntu in a long time.. and I completely turned off.  What an AWFUL experience.

TTFN gents.. on to the next project. (ok.. I stil have work with Emby.. but the server will run like a champ now)
 

Link to post
Share on other sites

just a fork of ffmpeg.. the omx extensions are the new baby.. and the same source I suspect will be used to compile both.

 

I wont waste any more time on this... I cant play a few movies without pre-re-encoding them into something more palatable

In 6 months I can look at it again.

 

Cheers mate.

Link to post
Share on other sites

SOLVED!

I was right!  It was a permissions issue.. related to root.

I was playing with Kodi and the OMXPlayer...  and in the OMXPlayer instructions I found this:

 

http://omxplayer.sconde.net/

"

Insufficient permissions to access /dev/vchiq
This can happen running omxplayer as user. To allow using omxplayer as user you need to do this:
# echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules
# usermod -aG video USERNAME-WHO-WILL-RUN-OMXPLAYER
# reboot

"

 

BOOM

 

The key here is granting the user emby access to the subsystem vchiq !

 

Take a look at this log output and WEEP:

 

 

http://192.168.50.60:8096/emby/videos/7ddceb88d6758be9ba09e290b420aa17/hls1/main/0.ts?DeviceId=4b23de016b5225894d6e76c8edb8536321d8b37b&MediaSourceId=7ddceb88d6758be9ba09e290b420aa17&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=1&VideoBitrate=3808002&AudioBitrate=192000&Level=51&Profile=high&PlaySessionId=049a5f459ad14c929e0ed8acdd16845a&api_key=0cd2a63298314854b714144b2291d7b0&CopyTimestamps=false&TranscodingMaxAudioChannels=6&EnableSubtitlesInManifest=false&Tag=bc219fa96243711adcfe308d4b24992f&RequireAvc=true&RequireNonAnamorphic=false&DeInterlace=false&SegmentContainer=ts&MinSegments=2&BreakOnNonKeyFrames=False

{"Protocol":"File","Id":"7ddceb88d6758be9ba09e290b420aa17","Path":"/media/usb0/Videos/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO.avi","Type":"Default","Container":"avi","Name":"480P/MPEG4/AC3","IsRemote":false,"ETag":"bc219fa96243711adcfe308d4b24992f","RunTimeTicks":44291301376,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"SupportsProbing":true,"RequiresLooping":false,"VideoType":"VideoFile","MediaStreams":[{"Codec":"mpeg4","CodecTag":"XVID","TimeBase":"417083/10000000","CodecTimeBase":"417083/10000000","IsInterlaced":false,"BitRate":2385784,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":400,"Width":720,"AverageFrameRate":23.97604,"RealFrameRate":23.97602,"Profile":"Advanced Simple Profile","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":5,"IsAnamorphic":false},{"Codec":"ac3","TimeBase":"1/24000","CodecTimeBase":"1/48000","DisplayTitle":"Dolby Digital stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":192000,"Channels":2,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0,"IsAnamorphic":false},{"Codec":"srt","Language":"eng","DisplayTitle":"Eng","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":2,"IsExternal":true,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":"/media/usb0/Videos/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO.eng.srt","IsAnamorphic":true}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":2579661,"RequiredHttpHeaders":{}}

ffmpeg -i file:"/media/usb0/Videos/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO.avi" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_omx  -b:v 2385784 -maxrate 2385784 -bufsize 4771568 -force_key_frames "expr:gte(t,n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 aac -strict experimental -ac 2 -ab 192000  -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3  -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/home/pi/transcoding-temp/7636a63775c8b9045d939fc8c5926192.m3u8" -y "/home/pi/transcoding-temp/7636a63775c8b9045d939fc8c5926192%d.ts"

ffmpeg version N-85641-gdd49eff Copyright © 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --enable-gpl --enable-nonfree --enable-mmal --enable-omx --enable-omx-rpi --enable-libmp3lame --enable-libx264 --enable-libvorbis
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 86.100 /  6. 86.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[avi @ 0x1e965e0] non-interleaved AVI
Input #0, avi, from 'file:/media/usb0/Videos/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO/Ice.Age.The.Great.Egg-Scapade.2016.HDRip.XviD.AC3-EVO.avi':
  Metadata:
    encoder         : AVI-Mux GUI 1.17.8.3, Feb 16 201019:42:50�
    JUNK            :
  Duration: 01:13:49.13, start: 0.000000, bitrate: 2579 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [sAR 1:1 DAR 9:5], 2385 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (h264_omx))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[mpeg4 @ 0x1ec90f0] Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it.
[h264_omx @ 0x1ec5b70] Using OMX.broadcom.video_encode
Output #0, segment, to '/home/pi/transcoding-temp/7636a63775c8b9045d939fc8c5926192%d.ts':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Video: h264 (h264_omx), yuv420p, 720x400 [sAR 1:1 DAR 9:5], q=2-31, 2385 kb/s, 23.98 fps, 90k tbn, 23.98 tbc
    Metadata:
      encoder         : Lavc57.93.100 h264_omx
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc57.93.100 aac
frame=   12 fps=0.0 q=-0.0 size=N/A time=00:00:00.72 bitrate=N/A speed=1.44x   
frame=   28 fps= 28 q=-0.0 size=N/A time=00:00:01.32 bitrate=N/A speed= 1.3x   
frame=   47 fps= 31 q=-0.0 size=N/A time=00:00:02.13 bitrate=N/A speed=1.39x   
frame=   75 fps= 37 q=-0.0 size=N/A time=00:00:03.28 bitrate=N/A speed=1.61x   
frame=   92 fps= 36 q=-0.0 size=N/A time=00:00:04.01 bitrate=N/A speed=1.57x   
frame=  115 fps= 38 q=-0.0 size=N/A time=00:00:04.97 bitrate=N/A speed=1.63x   
frame=  144 fps= 40 q=-0.0 size=N/A time=00:00:06.16 bitrate=N/A speed=1.73x   
frame=  170 fps= 42 q=-0.0 size=N/A time=00:00:07.25 bitrate=N/A speed=1.79x   
frame=  198 fps= 43 q=-0.0 size=N/A time=00:00:08.40 bitrate=N/A speed=1.84x   
frame=  224 fps= 44 q=-0.0 size=N/A time=00:00:09.51 bitrate=N/A speed=1.88x   
frame=  252 fps= 45 q=-0.0 size=N/A time=00:00:10.64 bitrate=N/A speed=1.91x   
frame=  283 fps= 47 q=-0.0 size=N/A time=00:00:11.98 bitrate=N/A speed=1.97x

 

 47FPS!!  

All the while the CPU looks like this:

(using the excellent cpustatus.sh script from https://gist.github.com/ecampidoglio/5009512 )

 

 

pi@avcenter:~ $ ./cpustatus.sh
Temperature:   54.8 C
Voltage:       1.39 V (+0.19 overvolt)
Min speed:     600 MHz
Max speed:     1300 MHz
Current speed: 1300 MHz
Governor:      ondemand

Overclocked slightly... and not even 60C!

Not even sure I need the overclocking.

I am having goosebumps

 

One thing I may investigate is the GPU/CPU ram sharing agreement.  Would it make a difference changing it?  I have 128MB allocated for the GPU... and it is slightly overclocked.

 

 

And this is the top half of my TOP window.. just for reference.

 

 

top - 22:05:08 up  8:02,  3 users,  load average: 1.25, 1.43, 1.46
Tasks: 151 total,   2 running, 147 sleeping,   0 stopped,   2 zombie
%Cpu(s): 26.6 us,  2.2 sy,  0.0 ni, 71.0 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem:    899012 total,   872224 used,    26788 free,   106992 buffers
KiB Swap:  1816572 total,     8924 used,  1807648 free.   497168 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
17681 pi        20   0  225320  20372   3476 R 106.8  2.3  20:25.46 ffmpeg
11914 pi        20   0  258168 194668  32512 S   3.3 21.7  20:30.02 mono-sgen
   69 root       1 -19       0      0      0 S   1.0  0.0   0:15.86 VCHIQ-0
17268 pi        20   0    5248   2568   2108 S   0.7  0.3   0:10.28 top
18619 pi        20   0    5116   2520   2108 R   0.7  0.3   0:00.13 top
   32 root      20   0       0      0      0 S   0.3  0.0   0:03.05 kswapd0
   85 root      20   0       0      0      0 S   0.3  0.0   0:01.67 jbd2/mmcblk0p2-
  283 root      20   0       0      0      0 S   0.3  0.0   0:03.82 usb-storage
  290 root      20   0    5432   2436   1264 S   0.3  0.3   0:55.72 mount.ntfs
  737 debian-+  20   0   29064   2836   2056 S   0.3  0.3   0:18.01 transmission-da

 

Gents.. this WORKS!  It plays Transcoded files better than high def directplay.. IO becomes the bottleneck rather than transcoding capabilities.

 

I had given up on it. and found the answer by accident.

 

Have a good one!

 

10155970-227043200_10-s4-v1.png?transpar

Edited by cachaca
  • Like 1
Link to post
Share on other sites
  • 4 months later...

Team LibreELEC has resumed work on transcoding (see here).

 

Currently, Emby uses a command similar to this, which does not hardware decode:

ffmpeg -i file:"input.mkv" -codec:v:0 h264_omx "output.ts"

 

Using a command similar to this uses hardware decode:

ffmpeg -codec:v:0 h264_mmal -i file:"input.mkv" -codec:v:0 h264_omx "output.ts"

 

Is there a way to experiment with the command Emby uses without having to recompile it?

 

Luke, how do you suggest to test this?

Link to post
Share on other sites

Dude this is awesome! this will enable hardware acceleration on the puny pi if i am understanding this correctly anyway. This is awesomesauce!

Lol now how do i fully utilize my license for mpeg2 hardware acceleration?

Link to post
Share on other sites

Luke,

 

I had a look at commit a1f27c2 and I am not sure it implements all the required flags.

 

Both the h264_mmal and the h264_omx flags are required for hardware acceleration:

ffmpeg -codec:v:0 h264_mmal -i file:"input.mkv" -codec:v:0 h264_omx "output.ts"

 

I can't find the h264_mmal flag in the code.

 

Looking forward to testing (not before Monday, though).

Link to post
Share on other sites

If I understand the code correctly (pls ignore me if I misunderstood it)
 
this commit Commit creates that command line

ffmpeg -i file:"input.mkv" -codec:v:0 h264_omx "output.ts"

this commit Commit change that command line to

ffmpeg -i file:"input.mkv" -codec:v:0 h264_mmal "output.ts"

but actually we need 

ffmpeg -codec:v:0 h264_mmal -i file:"input.mkv" -codec:v:0 h264_omx "output.ts"

h264_mmal is the hw decoder for the video
h264_omx is the hw encoder for the video
 
If just one of both is used the RPi is basically not usable for transcoding.

Edited by CvH
Link to post
Share on other sites
  • 11 months later...

Yes that's correct. Although the server understands omx, our ffmpeg builds do not include it, so that means you'd have to bring your own ffmpeg.

Link to post
Share on other sites
  • 10 months later...
Luke

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

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
×
×
  • Create New...