1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPi + Other Software Android TV software grabber?

Discussion in 'Software Support' started by Gershy13, 25 December 2017.

  1. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    I decided to grab that too (might as well not draw out this project for weeks waiting for things to ship).

    I'm sure I'll be back to progressively vent my frustration as this develops :thumbsup:
     
  2. Gershy13

    Gershy13 Member

    Messages:
    32
    Hardware:
    RPi2
    I wish you good luck! Hopefully the results will be positive
     
    • Like Like x 1
  3. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Okay I'm back - good news and bad.

    Overall, this exact setup is not going to work for me if I want to maintain 4k at 60hz. The HDCP standard adapter seems to have done nothing for the situation as you predicted, and adds nothing but another HDMI wire and occupied power plug. So scratch that totally from this configuration.

    The 4k -> RCA adapter (https://www.amazon.com/gp/product/B06XHKF945) does actually seem to be working and I haven't noticed any issues with it (mind that I only fiddled with it for about 10 minutes so far, so that isn't saying much). The problem here obviously is it does not support 4k at 60hz which means the TV will also be limited to 30hz.

    The USB grabber I got from amazon (https://www.amazon.com/dp/B0126O0RDC) seems to be working as expected with hyperion - so that is good news.

    So unless we can find a 4K60 -> RCA it seems like software may have to be the solution to this (without shelling out tons of cash). But I have to wonder if the expensive adapter from HDFury wouldn't just yield the exact same problem forcing the source to match the destination.

    I took a little bit of time to experiment with 'screenrecord' over adb, which provides a nice quality video feed, but the latency is a problem. I tried to do some scaling and fiddling with the bitrate but I couldn't get anything that seemed like a viable option.

    I guess the next attempt will be to try to produce some results using minicap, but it looks like that might take some effort to get running.
     
  4. Gershy13

    Gershy13 Member

    Messages:
    32
    Hardware:
    RPi2
    Hmm.. as I expected... What's minicap?

    Ideally this is what we would need... It's still pricey tho, but not as bad as the hdfury...
    It seems to be from the UK, so shipping costs would be high, unless you can find something from where you are from... It looks fairly unbranded so im pretty sure you should be able to find it under a different brand, maybe monoprice.

    https://www.clearvisionsystems.co.uk/hdmi-4k-to-1080p-up-down-scaler-repeater
     
  5. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    minicap is another adb application that will provide a video stream from the an android device. There is another thread here somewhere about people experimenting with it but it never really developed past that. Even with that though you would need to root your android device and disable the secured video sources flag using something like xposed to get content from netflix (it will output a black box). I would have started with that but getting it running looks like a real PITA.

    That device you linked to certainly looks promising. That is about the ceiling of what I would be willing to spend to get this working again. I'll take a look for something similar!

    I did notice this on the HDfury site: https://www.hdfury.com/product/splitter-4k-uhdpro/ which is a splitter that describes an integrated scaler:

    Splitter 4K UHD/PRO is a 2-Port DVI/HDMI splitter with integrated HDCP decryption/encryption engines, channel independant scaling engine and is compliant with HDMI Rev 1.4 and HDCP Rev 1.3 specifications.
    Splitter 4K UHD/PRO receives DVI/HDMI inputs, process HDCP decryption and encryption, scale up/down one or both channel and transmits the data to 2 DVI/HDMI ports.

    EDIT: ah nevermind, didn't notice it caps out at 30hz

    If that is the case, that device is $100 and has a splitter already integrated. I think I'll contact them and ask about it, will report back anything I learn!
     
  6. Gershy13

    Gershy13 Member

    Messages:
    32
    Hardware:
    RPi2
    Ahh right ok... Yeah I realised it capped at 30hz becuase it only supports hdmi 1.4...

    There must be cheaper scalers somewhere
     
  7. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Well I think I did source that product you linked to to an american retailer:
    https://www.hdtvsupply.com/18gbps-repeater-4k-scaler.html - $85 as of typing this which isn't too bad.

    Here is another device that is slightly more that seems to do the same thing, although I'm not sure if you would need to use their splitter to make it work:
    https://www.hdtvsupply.com/4k-down-converter.html

    I did also email HDfury for clarification on their gizmo, as the description does say "Up to 4K30 4:4:4 or 4K60 4:2:0" despite being HDMI rev1.4 - so let's see what they say

    EDIT:
    Actually, if the device I linked to here and the one you linked to are in fact the same, the description on the one I linked to says "Supports scaling up/down between 4K and 1080p (no frame rate conversion)"... So that may not even help then?

    EDIT2:
    Well damn, even the mythical 4K link by HDfury is incapable of converting the framerate (see the bottom of https://www.hdfury.com/4k-linker-ultra-scaling-modes-in-progress/). This is looking much more difficult than I anticipated.

    EDIT3: last one I swear!
    Actually frame rate conversion may not be a problem if downsampling to 1080p since [email protected] should still be compatible. I think I'm starting to overthink some of this!
     
    Last edited: 5 January 2018
  8. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Okay I got a response from HDfury:

    We have no device that can convert [email protected] to [email protected] All our devices work by scaling [email protected] to [email protected]
    The only devices that work for new hdcp 2.x devices [email protected] for scaling [email protected] to [email protected] is the vertex and linker.

    The uhd splitter and splitter 4k pro only work with old hdcp 1.4 x devices for scaling to and from 4k to 1080p and 1080p to 4k. So it will not work with hdcp 2.x devices such as the xbox one and ps4 and uhd bluray players.

    Hope this explains it better.


    So it seems the cheapest device HDfury has to do this would be the 4k->1080p scaler. Would probably solve the problem but that is a pretty steep price ($180 as of typing this).

    The product you linked to earlier is starting to look pretty appealing.

    EDIT: Decided to pull the trigger on that scaler from hdtv supply - hopefully that will get me to where I need to be!
     
    Last edited: 8 January 2018
  9. OLAS

    OLAS New Member

    Messages:
    3
    Found a way to stream directly from ADB to framebuffer or x11 into Hyperion.

    Code:
    adb exec-out "while true; do screenrecord --bit-rate=1m --output-format=h264 --size 320x180 --time-limit 180 -; done" | mplayer -demuxer h264es -fs -
    
    screenrecord has a max time of 180 seconds/3 minutes so we use a while loop here to maintain the stream
    I tested with vlc, ffplay and mplayer. They all worked but found mplayer had less latency. ffplay had initial latency but caught up to be as good as mplayer with the following;

    Code:
    adb exec-out "while true; do screenrecord --bit-rate=1m --output-format=h264 --size 320x180 --time-limit 180 -; done" | ffplay -framerate 60 -framedrop -bufsize 16M -probesize 16M -f -
    
    Initially I hooked up my server to accept debugging over USB then set ADB to be allowed to be connected to over TCPIP. You'll need either ffmpeg or mplayer installed. May as well install both as performance may vary depending on the setup.

    Code:
    adb connect 192.168.0.1 # or whatever your Android IP is
    
    Then run the adb exec-out command.

    I don't use Netflix or Amazon so not sure if they work. My Shield isn't rooted either.

    If you're doing this from SSH, you'll need to set your DISPLAY variable to execute the commands on the right display.
     
    • Like Like x 1
    • Informative Informative x 1
  10. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Very cool OLAS, I'll have to mess around with this!

    In my limited trials with screenrecord there was usually about a second or so delay between the screen and the and the resulting video feed - have you been able to reduce that latency?
     
  11. OLAS

    OLAS New Member

    Messages:
    3
    Even with 1920x1080 from the Shield to my X11 desktop, I was able to play Asphalt 8: Airborne on the X11 display. There was a tiny lag but almost unnoticeable - probably no more than 100ms. Resizing to to 320x180 only decreases the CPU usage on my server - I didn't notice any side-effects on the Shield. If I have time, I'll try emulate the setup on a CHIP.
     
  12. OLAS

    OLAS New Member

    Messages:
    3
    Just a little addendum. I used `-vo sdl` as a mplayer argument on my remote display as that was the fastest.
     
  13. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    I got a little time last night to fiddle with screenrecord over adb, and I'm pretty impressed by how responsive it was! When I was experimenting with that a couple weeks ago using my phone, there was a bit of latency that made it seem like it wouldn't work well. But on the shield it is a bit snappier!

    I am trying to get STF working on raspbian, but it is a bit of an uphill battle for me. I have an armv7 docker image of STF and a working copy of ADB installed on raspbian, but I'm not very familiar with docker so I am having some trouble getting all the pieces to work together. The end goal of that would be to use minicap to grab the screen as it is supposed to be relatively lag-free.

    I can confirm that things like netflix only output black though, so that would probably demand root access and possibly xposed to get around.

    Any idea on how to most effectively port the video stream to hyperion - preferably without just playing it and using the internal frame grabber?
     
  14. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Okay so I'm back to report my progress so far.

    Here is the current setup:
    Splitter: https://www.ebay.com/itm/ExpertBatt...t-1-in-2-out-Ultra-HD-4K-2K-60Hz/142379360229
    Scaler: https://www.hdtvsupply.com/18gbps-repeater-4k-scaler.html
    Convertor: https://www.amazon.com/gp/product/B06XHKF945
    Capture: https://www.amazon.com/gp/product/B0126O0RDC

    Right now, I'm thinking the convertor is messing with the configuration. As part of its standard it outlines support for 2160p, but only at 30hz. The scalar is supposed to scale from [email protected] -> [email protected], but I have a feeling the convertor that it is plugged into supporting [email protected] is causing some problems as the scalar never actually shows a 1080p output from the 4k signal (it has an indicator that show what the input and output signal are). I could probably test this theory by hooking up a TV that only supports 1080p maximum, but I don't have access to one at the immediate moment. I'll update this if I'm able to test with one.

    In the meantime, I ordered this convertor that does only support 1080p max: https://www.amazon.com/gp/product/B06W9LQDBB. I sure am hoping that helps.

    If not there is only one other splitter I could try that another user did report success with here (the only reason I didn't initially is because I wasn't sure if it supports CEC - the seller said it didn't, but that user confirmed it working for them at least).

    So the quest continues! :facepalm:
     
  15. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Back to document my misery! :LOL:

    So the scalar in my previous post I now think is defective - Both splitters with EDID management failed to make this device actually scale anything neither up nor down. I contacted the seller and outlined my frustration with it (zero documentation, literally more info posted about it in this thread than they can provide me), and to my surprise they actually offered to send me a different scalar at no additional charge. Honestly some great customer service there, I'm blown away.

    So I'm now waiting on this magical little device:
    https://www.hdtvsupply.com/4k-hdmi-audio-extractor-with-up-down-scaler.html

    The thing looks like it does just about everything (splits,scales,extracts,embeds), and actually seems pretty nice assuming it works. However, it does not do independant channel scaling so I do still need my splitter.

    I'll be sure to update with my findings!

    In related news; I have started work on an android grabber app and development so far is pretty positive. A few more parts to put together and I think I will have a minimal viable product to post here! :thumbsup::thumbsup:
     
    • Like Like x 2
  16. sMode

    sMode New Member

    Messages:
    4
    Hardware:
    RPi3
    Hello,

    i am looking for a solution for the same problem.

    The past days i was trying to mirror the Shield TV Screen via Adb to my Laptop. The plan is to play the stream in Fullscreen then
    send it to the Hyperion Server, to do that i think the ScreenCapture Program for Windows should the best way for it.

    I know it is a bit complicated and for sure Netflix/Amazon wont work but better than nothing!

    BUT in my Case the codes from OLAS dont work good, all i get is a pretty worst quality Stream. See the link.
    [​IMG]

    A little bit of reseach, shows diffrent variations of the ADB codes : https://stackoverflow.com/questions...ommand-to-mirror-android-screen-to-pc-via-usb
    But nothing really helps me.

    Any hints ?!

    It is good to hear that there is a devolopment for a Android TV Grabber app

    sorry for the bad english i am form Germany :D
     
  17. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Back again!

    The mystical device in my previous post unfortunately did not work for me - frankly I'm not sure why. I just could not get it to work with my setup... So I have abandoned my hopes for a hardware solution for this...

    The good news though is I think I am very close to an alpha release of an android screen-grabber. Here is a preview!


    (the colors may look a bit off because my wall is blueish)

    I have only just got this working so I'm still in the process of identifying any issues... This is only my second time writing java so I'm pretty sure there are problems I'm not even aware of yet. The github will be made public once I'm ready though, so I'm sure some more knowledgeable people can help influence it from there!

    So far the only issue I have so far is the service is prone to being killed, so I'll have to look into how to better handle that. Netflix does not work (which got cut out of the video), but that should not be a surprise to anybody familiar with how that works. This might be able to be resolved with root or something but I haven't got that far yet.

    Very close guys!
     
    Last edited: 8 February 2018
    • Like Like x 2
  18. BETEP-ok

    BETEP-ok New Member

    Messages:
    5
    Hardware:
    RPi1/Zero, RPi2, RPi3


    HEY! this is awesome.

    how can I test it with my TV?
    I have a Bravia 4k (55xd8577) - and I am totally missing my bright setup.... )
     
  19. abrenoch

    abrenoch Android Grabber Developer

    Messages:
    94
    Hardware:
    RPi1/Zero, RPi2
    Does the Bravia run android I assume? I'll be sure to post and apk for people to try out once I have the show-stopping bugs worked out! Right now the background service that runs the grabber is prone to being killed by the system, so it doesn't stay running for very long... I don't have any experience dealing with that kind of stuff in android, so it is a whole lot of trial and error. I am going to make all the code public though; so hopefully someone familiar with all this can take a look and improve it!

    I'm going to spend some time today tinkering with it, hopefully I will be able to share something soon!
     
  20. BETEP-ok

    BETEP-ok New Member

    Messages:
    5
    Hardware:
    RPi1/Zero, RPi2, RPi3
    Yup
    Sony build their smart tvs on the basis of Android
    My device is now v6.0.1

    If you manage to make a stable running grabber- it’s gonna be a hammer! Fir all the Android users

    Important is to keep the hardware decoding active. Without it - 4K playback is not possible.