[Howto] Accelerated video playback with Chrome plugin

Moderators: meveric, mdrjr, odroid

[Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Fri Sep 30, 2016 10:44 pm

Update: Even if this article says it's for a C2, this plugin works on any generic Linux installation with Chrome (you could run it on your PC as well). Regarding the player, you can use c2play on C0/C1/C2 for accelerated playback, or gnome-video for XU3/4 on memeka's wayland image (when it's ready): viewtopic.php?f=95&t=23163#p155758

If you're using your C2 as a desktop computer, chances are you're also surfing the web on it. By now you might have noticed that in-browser video playback may not have the performance you would expect… You can get 720p Youtube playback in-browser but it's choppy, so 360p is the only acceptable resolution where playback is ok. Other sites simply complain that they can't play video, so that's annoying.
Accelerated video playback requires two things - accelerated video decoding - which is handled by aml-libs on C1/C2 and accelerated rendering - which should be handled by X11 drivers. Unfortunately, chrome does not support accelerated video decoding for aml-libs, so playback is done with CPU decoding, which is slow. The idea of this article is to (somehow) offload video playback to a process which can do it accelerated and away from the browser.

The best way to do it
Well, the best way to have accelerated Chrome video playback is to change Chrome's source code and add support for aml-libs. If you look into Chromium's documentation (https://www.chromium.org/developers/des ... ents/video) you can see that a custom-built ffmpeg is used for video decoding. This means that once some brave developer ports aml-libs support to ffmpeg, we might have Chromium builds that play accelerated videos on C1/C2. Work is being done with patches to ffmpeg by forum user @LongChair that should allow native playback in the end: viewtopic.php?f=112&t=23521. Hopefully, by the time you're reading this article this approach is already working.

Image
Figure 1. Render Process diagram

The convoluted way to do it

This approach is inspired by work done by a friend of mine on Firefox. It might not be directly applicable to Chromium due to changes in Chromium's plugin API (and its deprecation of NAPI). So, the story goes that my friend has a very old PC that he uses to browse the web. Unfortunately the PC could not keep up with playing back video content in the browser but it could do the job in an external player, so my friend (whom I'll call Silviu for his protection) decided to do something about it instead of throwing money at the problem. He used Firefox, the Greasemonkey plugin, wrote his own Firefox plugin and managed to offload playback to mpv, but integrated things to appear to happen inside the browser window. This is what I wanted to try to replicate on Odroids at first.

What he did was to use Greasemonkey to load a custom 1600 line javascript code that overrides all HTML5 video elements and replaces them with proxy objects that forward the calls to his plugin. For this he needed to reimplement the whole HTML5 video API which is described here: https://developer.mozilla.org/en/docs/W ... ment/video and here: https://developer.mozilla.org/en-US/doc ... dia_events . His code gets the calls the browser makes to create new video objects, set the video source and start/seek/stop playback.

Upon intercepting the messages, the javascript code creates a request with a fake content-type which is handled by a plugin library specially designed to be the middleman in this scenario. The javascript code doesn't have the right to read or execute files, but plugins do, so the plugin is used to start up a mpv instance and communicates with it through a pipe. The javascript code sends play/pause/seek requests to the plugin, the plugin converts it to mpv commands and sends it to the mpv process and mpv does the hard work. Also the reverse is true - when you control mpv through its built-in controls it reports things such as play/pause/seek events back to the plugin library which translates them back to javascript events which are passed through the Greasemonkey plugin back to the original player.

The effect is that the original player shows the correct status, current position and can be used to control the player in an intuitive way. This is important because a lot of sites have built-in protections against scraping and may query periodically through javascript to see the payer's state.

In terms of presentation, using a plugin allows you to create a new operating system window (without titlebar decorations) and position it on top of the HTML5 video object. The fun fact is that the window is embedded inside the webpage so it scrolls and gets hidden out of view when you scroll. MPV can use the --wid parameter to draw its output to an arbitrary window (this works in Windows and Linux alike and is a cool option). This makes the player look like it's native and unobtrusive. Also, the plugin allows you to create multiple instances of the player (for different tabs for instance).


Image
Figure 2. Mpv plays to a Mousepad editor window

Unfortunately, the solution I've seen was tested only on Firefox and Windows, but with a bit of work might be ported to Chromium as well. I have to convince my friend to release his sources so that others can join in…

Image
Figure 3. Firefox proof-of-concept with skinned mpv controls

The way we're going to do it
A relatively simple way to get accelerated playback from the browser is to pass the URL of the video to a player which has aml-libs support. Fortunately, following a long and very entertaining discussion on the forum viewtopic.php?f=136&t=21948 we now have a standalone player for the C2 and also patches to ffmpeg and mpv that could lead to a more diverse player selection in the future. But for our needs we'll use c2play, a minimalistic player built especially for the C2 by forum user crashoverride (viewtopic.php?f=136&t=23143).
The plan consists of the following:
* Create a chrome plugin to send the current URL (or the video element's URL) to a backend script
* The backend script calls youtube-dl to get the video URL and calls the player to play it

Fortunately Chrome has a native messaging API (https://developer.chrome.com/extensions/nativeMessaging) that lets you communicate with external processes (which it's kind enough to spawn for you), so this is what we'll do.

To install c2play you will need to consult the latest instructions from the support thread viewtopic.php?f=136&t=23143, since development is progressing rapidly. But at the time of this writing you can install it with:

Code: Select all
$ git clone -b beta1 https://github.com/OtherCrashOverride/c2play.git
$ sudo apt-get install libasound2-dev libavformat-dev libass-dev libx11-dev premake4
$ cd c2play
$ premake4 gmake
$ make c2play-x11
$ sudo cp c2play-x11 /usr/local/bin/c2play-x11


You'll also need youtube-dl, which you can get from Ubuntu's repositories or directly from here: https://rg3.github.io/youtube-dl/. Youtube-dl is a program that takes a page URL and extracts the video element URL embedded inside. It can do this for a wide list of sites (https://rg3.github.io/youtube-dl/supportedsites.html) that either use HTML5 or Flash for playback. I recommend you install it manually, because changes to sites happen often and you'll need to be able to update it easily.
Code: Select all
$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl



Finally, to install the Chrome plugin that ties all of these together follow these steps:
Code: Select all
$ git clone https://github.com/mad-ady/odroid.c2.video.helper.git
$ cd odroid.c2.video.helper
$ sudo apt-get install libjson-perl libproc-background-perl libconfig-simple-perl


To install the plugin, you will need to navigate inside chrome to chrome://extensions/. Next you will need to drag and drop from a file browser the extension located in odroid.c2.video.helper/release/odroid.c2.video.helper-1.1.crx into the chrome window and it will prompt you to install it.

Image
Figure 4. Plugin installation

Once it is installed continue to install the backend script:

Code: Select all
$ cd host
$ bash install_host.sh


The install_host.sh script creates the necessary directories in your Chromium installation and copies over the backend script (typically to $HOME/.config/chromium/NativeMessagingHosts) and its configuration file to your home directory.

At this point you should see a new button that looks like a video player (better icons are welcome!) next to your address bar.

Image
Figure 5. Push the button!

Now, when you navigate to a website that has a video embedded you can press this button and the tab's URL will be passed to the backend script. The backend script will run it through youtube-dl (this can take about 5-6 seconds) and will obtain the URL of the video. It will then call the preferred player with this URL and playback should start. Here's a video of the installation (and playback) process:
https://youtu.be/Z3ng8Qm8STI

At the time of writing I only tested it with c2play-x11 and playback is full-screen. In order to control it consult the help page viewtopic.php?f=136&t=23143&p156050. Adding windowed playback support is on crashoverride's todo list (https://github.com/OtherCrashOverride/c2play/issues/6) and will probably become a reality in the future. Also LongChair's mpv port could be used for playback. For now I've tried with the stock mpv and playback is fine for SD content, but 720p lags. You can view a demo here: https://youtu.be/fJLv0cwPyfg

Image
Figure 6. Playback in mpv (non-accelerated)

The backend script has a configuration file stored at ~/.odroid.c2.video.helper.conf and has an ini syntax. Here you can disable debugging (which is on by default), you can change the player and set custom parameters (such as quality) for various sites supported by youtube-dl. For instance, the default config file sets the youtube quality to 720p (-f 22) and disables playlist support. You can add new sections that must have a name that matches the URL's domain. Also, the section name must not contain the character dot (".") because it's not well supported by the configuration parser module. To view debugging information you can run:

Code: Select all
$ sudo journalctl -f


Image
Figure 7. Configuration sample

Playing 1080p or 4k from youtube is a bit more problematic because for resolutions higher than 720p youtube splits video and audio in two distinct streams and their player merges them in the client. This doesn't happen on other sites, like Vimeo, for instance. Fortunately, crashoverride has a branch (dualstream) that tries to support this https://github.com/OtherCrashOverride/c2play/issues/12. Preliminary tests show that he is on the right track - I was able to play 4K video with his player, but playback stalled after some seconds. This will likely improve in the near future.

So, what should you expect to work and what isn't working? Sites supported by youtube-dl, such as Youtube (obviously), Vimeo, Facebook, IMDB, Engadget, DailyMotion, TED, Cracked, Apple Trailers, 9gag TV and a variety of adult sites should work. In order to play content you need to navigate to a page with a single video on it and click on the button next to the address bar. However, sites which require login to view the content will not work, nor will sites which require cookies to access the data. Sample tested content:
Code: Select all
IMDB: http://www.imdb.com/video/imdb/vi1000650265?ref_=tt_pv_vi_aiv_1
Engadget: https://www.engadget.com/video/57e9cc8476a6056f1ea2995d/
Dailymotion: http://www.dailymotion.com/video/x4var61_eye-popping-gopro-footage-from-the-divers-perspective-in-mostar_sport
TED: http://www.ted.com/talks/sam_harris_can_we_build_ai_without_losing_control_over_it
Cracked: http://www.cracked.com/video_20178_sex-games-giant-tea-sets-craziest-star-trek-episode.html
Apple trailers: http://trailers.apple.com/trailers/sony_pictures/passengers/
9gag.tv: http://9gag.com/tv/p/awapEM/spacex-interplanetary-transport-system?ref=tcl
Facebook: https://www.facebook.com/SpaceX/videos/vb.353851465130/10158028115495131/?type=3&theater


Relying on youtube-dl for sites which support it is fine, but my idea was to retrieve the URL to the video directly from the browser's DOM. In case you're not aware of how things work in the wild Internet, web pages can create video objects that have various properties including a source pointing to the video being played. Youtube-dl uses page scraping and lots of internal magic to extract this URL and present it to other processes. But since we're running inside the browser we should be able to get the source of the video thus saving about 6 seconds of processing time. I modified the chrome extension to look for video objects and the plan was to create a button which would initiate playback externally. But this is set to fail since each page embeds the video under various layers of objects, most of which are either hidden or overlap with other ones, so the button would be hidden or positioned incorrectly in the page.

My next attempt was to intercept the "playing" event and pause the video, steal the URL and pass it to the backend for playback. This worked surprisingly well for my test site (http://www.quirksmode.org/html5/tests/video.html), but failed for larger sites such as youtube/vimeo. Digging through the page revealed why - these sites use a technique called "media-source" https://en.wikipedia.org/wiki/Media_Source_Extensions which uses javascript to make requests and stream the video, so we can't extract a URL to pass for playback.

Image
Figure 8. Normal video object vs media-source

So, for sites that use a video element with a real URL as src the plugin will play the content with the external player on the first playback attempt. If you try to play the video again (without reloading the page) it will play normally, inside the page. This is a protection in case the external player can't handle the video format and you want to fall back to the browser. In this case you should just see a black window flash briefly on the screen while playback is attempted, otherwise it will play normally.

I have released two versions of the plugin. Version 1.1 supports only playback through youtube-dl through the use of the toolbar button. Version 1.2 adds direct playback experimental support, but may not always work or may be too annoying for videos which play automatically when you enter the page, so which plugin you use is up to your needs.

I'd like to hear your suggestions and feedback on the support thread:

And all this wouldn't have been possible without the hard work of crashoverride and LongChair - so send them a big thanks! :)
Last edited by mad_ady on Mon Nov 14, 2016 4:58 pm, edited 6 times in total.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby odroid » Sat Oct 01, 2016 6:12 pm

Thank you for very exciting news.
I will try it early next week.
User avatar
odroid
Site Admin
 
Posts: 23972
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Tue Oct 11, 2016 8:46 pm

Hello all,
I've updated the first post with more details. I kind of managed to get the video URL directly from the browser (in some cases) and pass it to the player. But it doesn't work on big sites. Details here:

Relying on youtube-dl for sites which support it is fine, but my idea was to retrieve the URL to the video directly from the browser's DOM. In case you're not aware of how things work in the wild Internet, web pages can create video objects that have various properties including a source pointing to the video being played. Youtube-dl uses page scraping and lots of internal magic to extract this URL and present it to other processes. But since we're running inside the browser we should be able to get the source of the video thus saving about 6 seconds of processing time. I modified the chrome extension to look for video objects and the plan was to create a button which would initiate playback externally. But this is set to fail since each page embeds the video under various layers of objects, most of which are either hidden or overlap with other ones, so the button would be hidden or positioned incorrectly in the page.
My next attempt was to intercept the "playing" event and pause the video, steal the URL and pass it to the backend for playback. This worked surprisingly well for my test site (http://www.quirksmode.org/html5/tests/video.html), but failed for larger sites such as youtube/vimeo. Digging through the page revealed why - these sites use a technique called "media-source" https://en.wikipedia.org/wiki/Media_Source_Extensions which uses javascript to make requests and stream the video, so we can't extract a URL to pass for playback.

So, for sites that use a video element with a real URL as src the plugin will play the content with the external player on the first playback attempt. If you try to play the video again (without reloading the page) it will play normally, inside the page. This is a protection in case the external player can't handle the video format and you want to fall back to the browser. In this case you should just see a black window flash briefly on the screen while playback is attempted, otherwise it will play normally.

I have released two versions of the plugin. Version 1.1 supports only playback through youtube-dl through the use of the toolbar button. Version 1.2 adds direct playback experimental support, but may not always work or may be too annoying for videos which play automatically when you enter the page, so which plugin you use is up to your needs.

Feedback is welcome
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby rooted » Wed Oct 12, 2016 2:04 am

Nice work mate, very useful.
User avatar
rooted
 
Posts: 3652
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Wed Oct 12, 2016 3:21 am

Credit goes to crashoverride for digging into amllibs. I only glued things together. Incidentally, this extension should work on any odroid type (or any linux system) if you have a working player
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby rooted » Wed Oct 12, 2016 4:27 am

mad_ady wrote:Credit goes to crashoverride for digging into amllibs. I only glued things together. Incidentally, this extension should work on any odroid type (or any linux system) if you have a working player

I was referring to your work ;)

I have followed crashoverride's c2play thread, he has created one of the most useful players to see an odroid.

I use Android on the C2 so none of this has any consequence to me personally, I just appreciate all the community does.
User avatar
rooted
 
Posts: 3652
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Wed Oct 12, 2016 7:11 pm

Another update. By using crashoverride's dualstream branch of the c2play player you can get 4K video playback with this plugin (you'll need to update to the latest version).
To install the dualstream branch follow these steps:
Code: Select all
$ git clone -b dualstream https://github.com/OtherCrashOverride/c2play.git
$ sudo apt-get install libasound2-dev libavformat-dev libass-dev libx11-dev premake4
$ cd c2play
$ premake4 gmake
$ make c2play-x11
$ sudo cp c2play-x11 /usr/local/bin/c2play-x11


To request 4K videos from youtube you'll need to set the correct parameters in the config file (~/.odroid.c2.video.helper.conf):
Code: Select all
[general]
debug=1
playerdebug=1
player=/usr/local/bin/c2play-x11

[youtu]
;set quality to 720p
;extraArgs="-f 22 --no-playlist"
;set quality to 3840x2160 with audio mp4a.40.2@128k (44100Hz)
extraArgs="-f266,140 --no-playlist"

[vimeo]



Most notably comment out the -f 22 line and uncomment the -f266 line. To see which formats you can get from a video you can run:
Code: Select all
youtube-dl -F https://www.youtube.com/watch?v=2b9txcAt4e0


Save and you should be good to go. Unfortunately not all videos will support those hardcoded formats, so you will only be able to play 4K videos and nothing else (on youtube). Since scanning for available formats takes about 5-6 seconds and requesting the lists also takes 5-6 seconds, I'm open to suggestions on how I should handle this to reduce delays... One way would be to request several formats and select the best one based on what results were returned. This would require adding some "format logic" to the backend script. I'll look into it.

Oh, for now you have to set playerdebug=1 to use the dualstream feature. I'll get it sorted to work without it soon.

Let me know how it works, but be advised, 4K support for youtube is considered alpha. For me it hangs after playing 10-20 seconds, but I haven't tested everything. Requests and notes about stability should be directed to crashoverride for investigation.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Mon Oct 31, 2016 5:01 pm

I've updated the code so that 4K videos work with playerdebug set to 0 as well. I also tested it with this video: https://www.youtube.com/watch?v=ChOhcHD8fBA and was able to play it back in 4k with small dips in framerate. The stuttering was caused by network bufferring - when the buffer was ok playback was smooth, when the buffer was depleted playback lost some frames. But other than that - quite watchable.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby ximae » Sun Nov 06, 2016 6:30 pm

willl this work on sites like streamcloud,powvideo, streamin , etc ?
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Sun Nov 06, 2016 11:38 pm

I've never heard of those sites. Are they supported by youtube-downloader?
Otherwise they should work if:
1. They use html5 video elements with a src attribute that points to the actual video
2. The video element gets loaded with the page (and not afterwards - e.g. after the user clicks a button)
Give it a try and let us know...
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby ximae » Mon Nov 07, 2016 1:30 am

I dont have a c2 board yet, my c1 is part of my dvs that i use to play out so i really dont fiddle much with it.

could you try if it works with this link : http://streamcloud.eu/io6fu5c3fdtb/F4R6 ... E.avi.html

it is html5... but u do have to click a button to start it aftar a countdown.

this one doesnt, http://gamovideo.com/8s06lixs2mza

edit: ok i actually checked and stremcloud.eu vids have a link to the video in the sourcecode of the page. the link for the link i posted above would be :

http://stor49.streamcloud.eu:8080/z7v74 ... /video.mp4
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Mon Nov 14, 2016 4:50 pm

Quick update - I added a new configuration option in the ini file. You can now specify "direct=1" for sites that are supported directly by your player. E.g. gnome-video can automatically handle youtube links.

@ximae: I forgot about your link and only tested today. The second link works with the plugin. It seems it's supported by youtube-dl. Also, the plugin and c2play should also work on a C1/C0 (crashoverride is still making changes and adding support), so give it a try and let us know how it works.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby ximae » Wed Nov 16, 2016 3:05 am

dont worry i have my c2 now, i can test for my self... the second link worked as u mentioned i was using the 1.2 script too... ill delve more into this in a few days.
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Wed Nov 16, 2016 3:30 am

Great!
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Sat Aug 05, 2017 10:57 am

I purchased an Odroid-C2 in late 2016. It came with Ubuntu 16.04 already installed on the eMMC flash storage. I was looking for a solution to offload videos away from the browser. I liked your idea to implement that, so gave it a go. It worked as a treat following your steps provided on this post. But, I made the mistake to upgrade to Ubuntu 17 and since then c2player stopped working. I re-installed the Ubuntu 16.04 March 2017 release, updated the system and re-installed c2play following exactly your steps. But, this time I can't playback externally anymore videos when pressing the button on the Chrome browser.

Please note there is no problem to play videos with c2play-X11 when videos are downloaded on the flash storage with youtube-dl. It looks like the tab's URLis is not passed to the backend script.

Currently my Odroid is running on this kernel version:

odroid@odroid64:~/Downloads$ uname -a
Linux odroid64 3.14.79-115 #1 SMP PREEMPT Mon Jul 10 12:13:00 BRT 2017 aarch64 aarch64 aarch64 GNU/Linux

and Chromium is running Version 59.0.3071.109 (Developer Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit).

Any help to fix the problem should be really appreciated.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Sat Aug 05, 2017 3:30 pm

Have you also installed youtube-dl? Can you check that youtube-dl can find the video you're looking for and the quality you've requested?
There should also be some logs in syslog if you grep for video.helper
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Sat Aug 05, 2017 7:56 pm

- Have you also installed youtube-dl? -- Yes, I did.

odroid@odroid64:/var/log$ dpkg -s youtube-dl
Package: youtube-dl
Status: install ok installed
Priority: extra
Section: web
Installed-Size: 3444
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Version: 2016.02.22-1
Depends: python-pkg-resources, python:any (<< 2.8), python:any (>= 2.7.5-5~)
Recommends: aria2 | wget | curl, ffmpeg | libav-tools, mpv | mplayer | mplayer2, rtmpdump
Conffiles:
/etc/bash_completion.d/youtube-dl.bash-completion e077492bd13887a1c5a0774c9b93291e
/etc/fish/completions/youtube-dl.fish 8488c13cf1c0367e72202a28d4e1cb76
Description: downloader of videos from YouTube and other sites
youtube-dl is a small command-line program to download videos from
YouTube.com and other sites that don't provide direct links to the
videos served.
.
youtube-dl allows the user, among other things, to choose a specific video
quality to download (if available) or let the program automatically
determine the best (or worst) quality video to grab. It supports
downloading entire playlists and all videos from a given user.
.
Currently supported sites (or features of sites) are:
.
1tv, 1up.com, 20min, 220.ro, 22tracks:genre, 22tracks:track, 24video, 3sat,

- Can you check that youtube-dl can find the video you're looking for and the quality you've requested? -- Would you like assistance how to do this?
I can confirm I was able to download Goodnight Inspires-1000650265.mp4 movie into my Download folder and ran it with c2play-x11. All working OK. But, no chance to open this video or any other videos when pressing Odroid C2 video helper button in Chrome

odroid@odroid64:~/Downloads$ youtube-dl http://www.imdb.com/videoplayer/vi10006 ... v_vi_aiv_1
[imdb] 1000650265: Downloading webpage
WARNING: unable to extract description; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
[imdb] 1000650265: Downloading player page
[imdb] 1000650265: Downloading info for SD format
[imdb] 1000650265: Downloading info for 720p HD format
[download] Destination: Goodnight Inspires-1000650265.mp4
[download] 100% of 20.73MiB in 00:14
odroid@odroid64:~/Downloads$

odroid@odroid64:~/Downloads$ c2play-x11 Goodnight\ Inspires-1000650265.mp4
added device: /dev/input/event4
added device: /dev/input/mouse0
added device: /dev/input/event3
added device: /dev/input/event2
added device: /dev/input/event7
added device: /dev/input/event6
added device: /dev/input/mouse1
added device: /dev/input/event5
added device: /dev/input/event1
added device: /dev/input/event0
added device: /dev/input/mice
Device: /dev/input/event4
bustype=3, vendor=3727, product=32, version=272
name=GASIA PS2toUSB Adapter
InputDevice entering running state.
Device: /dev/input/mouse0
EVIOCGBIT failed.
Device: /dev/input/event3
bustype=3, vendor=3727, product=32, version=272
name=GASIA PS2toUSB Adapter
InputDevice entering running state.
Device: /dev/input/event2
bustype=3, vendor=16700, product=42243, version=256
name=Dell Dell AC511 USB SoundBar
InputDevice entering running state.
Device: /dev/input/event7
bustype=0, vendor=0, product=0, version=0
name=lircd
InputDevice entering running state.
Device: /dev/input/event6
bustype=0, vendor=0, product=0, version=0
name=MCE IR Keyboard/Mouse (meson-ir)
InputDevice entering running state.
Device: /dev/input/mouse1
EVIOCGBIT failed.
Device: /dev/input/event5
bustype=25, vendor=0, product=0, version=0
name=meson-ir
InputDevice entering running state.
Device: /dev/input/event1
bustype=25, vendor=5812, product=1793, version=1
name=vt-input
InputDevice entering running state.
Device: /dev/input/event0
bustype=16, vendor=7054, product=3308, version=1
name=cec_input
InputDevice entering running state.
Device: /dev/input/mice
EVIOCGBIT failed.
Using input device: GASIA PS2toUSB Adapter
Using input device: GASIA PS2toUSB Adapter
Using input device: Dell Dell AC511 USB SoundBar
Using input device: lircd
Using input device: MCE IR Keyboard/Mouse (meson-ir)
Using input device: meson-ir
Using input device: vt-input
Using input device: cec_input
X11Window: width=2560, height=1440
EGL: major=1, minor=4
EGL: Vendor=ARM
EGL: Version=1.4 Linux-r6p1-01rel0
EGL: ClientAPIs=OpenGL_ES
EGL: Extensions=EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_swap_buffers_with_damage EGL_EXT_swap_buffers_with_damage EGL_KHR_lock_surface EGL_KHR_lock_surface2 EGL_EXT_create_context_robustness EGL_ANDROID_blob_cache EGL_KHR_create_context EGL_KHR_partial_update EGL_KHR_create_context_no_error
EGL: ClientExtensions=EGL_EXT_client_extensions EGL_EXT_platform_base EGL_KHR_platform_x11

X11Window: xwin = 69206018
Source Metadata:
key=major_brand, value=isom
key=minor_version, value=512
key=compatible_brands, value=isomiso2avc1mp41
key=encoder, value=Lavf57.25.100
Duration: 53.103000
Streams (count=2):
stream #0 - AUDIO/AAC
stream #1 - VIDEO/H264
w=1280 h=720 fps=23.976024(24000/1001) SAR=(0/1)
AmlCodec: amstream version : 2.0
Element (AudioCodec) Flush exited.
Element (AudioSink) Flush exited.
AmlVideoSinkElement: calling base.
Element (VideoSink) Flush exited.
AmlVideoSinkElement: Flush exited.
Element (Source) Flush exited.
Element (VideoSink) ChangeState oldState=0 newState=1.
Element (AudioCodec) ChangeState oldState=0 newState=1.
Element (AudioSink) ChangeState oldState=0 newState=1.
Element (Source) ChangeState oldState=0 newState=1.
AmlVideoSink: ExtraData size=41
AmlVideoSink - VIDEO/H264
AudioCodecElement: outInfo->SampleRate=44100, outInfo->Channels=2
AlsaAudioSinkElement: isFirstData changed.
w=1280 h=720 fps=23.976024 am_sysinfo.rate=4004
AmlVideoSinkElement: got marker buffer Marker=2
Header (pkt.size=d60):
00 00 02 ab 06 05 ff ff a7 dc 45 e9 bd e6 d9 48
isAnnexB=0
SetupAlsa: frameSize=1024
snd_pcm_delay failed.
snd_pcm_delay failed.
AmlVideoSink: Adjust PTS - pts=0.184644 vpts=0.041700 drift=-0.142944 (-3.427239 frames)
AmlVideoSink: Adjust PTS - pts=0.184911 vpts=0.041700 drift=-0.143211 (-3.433633 frames)
AmlVideoSink: Adjust PTS - pts=0.185144 vpts=0.041700 drift=-0.143444 (-3.439227 frames)
AmlVideoSink: Adjust PTS - pts=0.185322 vpts=0.041700 drift=-0.143622 (-3.443490 frames)
GASIA PS2toUSB Adapter: KeyPressed 1 (0x1)
MAIN: Playback finished.
MediaPlayer: terminating audioSink.
Element (AudioSink) ChangeState oldState=1 newState=0.
Element (AudioSink) Flush exited.
Element (AudioSink) InternalWorkThread - Terminating
Element (AudioSink) InternalWorkThread exited.
Element (AudioSink) thread.Join().
Element (AudioSink) Terminate.
MediaPlayer: terminating audioCodec.
Element (AudioCodec) ChangeState oldState=1 newState=0.
Element (AudioCodec) Flush exited.
Element (AudioCodec) InternalWorkThread - Terminating
Element (AudioCodec) InternalWorkThread exited.
Element (AudioCodec) thread.Join().
Element (AudioCodec) Terminate.
MediaPlayer: terminating videoSink.
Element (VideoSink) ChangeState oldState=1 newState=0.
AmlVideoSinkElement: calling base.
Element (VideoSink) Flush exited.
AmlVideoSinkElement: reset.
AmlVideoSink - VIDEO/H264
w=1280 h=720 fps=23.976024 am_sysinfo.rate=4004
AmlVideoSinkElement: Flush exited.
Element (VideoSink) InternalWorkThread - Terminating
Element (VideoSink) InternalWorkThread exited.
Element (VideoSink) thread.Join().
Element (VideoSink) Terminate.
MediaPlayer: terminating source.
Element (Source) ChangeState oldState=1 newState=0.
Element (Source) Flush exited.
Element (Source) InternalWorkThread - Terminating
Element (Source) InternalWorkThread exited.
Element (Source) thread.Join().
Element (Source) Terminate.
MediaPlayer: destructed.
Element VideoSink destructed.
GASIA PS2toUSB Adapter: KeyReleased 1 (0x1)


- There should also be some logs in syslog if you grep for video.helper-- I have checked any entry for video.helper in syslog and is none:
odroid@odroid64:/var/log$ dmesg | grep video.helper
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Sat Aug 05, 2017 8:17 pm

I think I know where the problem is. The plugin uses a hardcoded path to youtube-dl which is /usr/local/bin/youtube-dl (assumes a manual installation), but your youtube-dl is probably in /usr/bin/youtube-dl.

You can either install youtube-dl manually as described in the first post, or create a symlink in /usr/local/bin/youtube-dl to /usr/bin/youtube-dl.

Regarding config and logs, if you still have the problem, show me the contents of ~/.odroid.c2.video.helper.conf and sudo cat /var/log/syslog | grep video.helper
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Sat Aug 05, 2017 9:12 pm

- The plugin uses a hardcoded path to youtube-dl which is /usr/local/bin/youtube-dl (assumes a manual installation), but your youtube-dl is probably in /usr/bin/youtube-dl. -- Yes, you are right. I did a manual installation:

odroid@odroid64:/usr/local/bin$ ls -l
total 6872
-rwxr-xr-x 1 root root 5475592 Aug 5 00:24 c2play-x11
-rwxr-xr-x 1 root root 1559297 Aug 5 21:48 youtube-dl

odroid@odroid64:/usr/bin$ ls -l | grep youtube-dl
-rwxr-xr-x 1 root root 87 Feb 26 2016 youtube-dl

- You can either install youtube-dl manually as described in the first post, -- I did it following your steps, but still the problem is not solved:

odroid@odroid64:~$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
odroid@odroid64:~$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

- or create a symlink in /usr/local/bin/youtube-dl to /usr/bin/youtube-dl.-- Do you mind if I ask you to provide the command to do this? Working with symlinks is not one of my strongest skills in working with Ubuntu
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Sun Aug 06, 2017 10:22 am

I have created a symlink from /usr/local/bin/youtube-dl to /usr/bin/youtube-dl:

odroid@odroid64:~$ sudo ln -s /usr/local/bin/youtube-dl /usr/bin/youtube-dl
ln: failed to create symbolic link '/usr/bin/youtube-dl': File exists
odroid@odroid64:~$ sudo unlink /usr/bin/youtube-dl
odroid@odroid64:~$ sudo ln -s /usr/local/bin/youtube-dl /usr/bin/youtube-dl
odroid@odroid64:~$

I have tried to replay again the youtube video in the external playback, but still no luck. Below is the output of the the contents of ~/.odroid.c2.video.helper.conf:

odroid@odroid64:~$ sudo cat /var/log/syslog | grep video.helper
odroid@odroid64:~$

Any thoughts what is the next step?
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Sun Aug 06, 2017 1:30 pm

I think you've just deleted your youtube-dl when you called unlink on it. Never mind, here's what I suggest - install the latest version manually, because it's easier to update:
Code: Select all
sudo apt-get remove youtube-dl
sudo rm -f /usr/local/bin/youtube-dl
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl


You haven't pasted the contents of .odroid.c2.video.helper.conf. Is it empty? Can you also redo the plugin installation as described in the first post?
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Sun Aug 06, 2017 6:44 pm

- The content of the .odroid.c2.video.helper.conf file is:
GNU nano 2.5.3 File: .odroid.c2.video.helper.conf

[general]
debug=1
playerdebug=1
player=/usr/local/bin/c2play-x11

[youtu]
;set quality to 720p
extraArgs="-f 22 --no-playlist"
direct=0
;set quality to 3840x2160 with audio mp4a.40.2@128k (44100Hz)
;extraArgs="-f266,140 --no-playlist"

[vimeo]

- The content of the home folder is :
odroid@odroid64:~$ ls -A
.bash_history .ICEauthority .remmina
.bash_logout .joe_state resize.log
.bashrc .local .sudo_as_admin_successful
c2play Music Templates
.cache .nano Videos
.config odroid.c2.video.helper .vnc
.dbus .odroid.c2.video.helper.conf .wget-hsts
Desktop .pam_environment .Xauthority
.dmrc .pam_environment~ .xinputrc
Documents Pictures .xsession-errors
Downloads .pki .xsession-errors.old
.gconf .profile
.gnome Public


- The content of the c2play folder is:
odroid@odroid64:~/c2play$ ls -A
build .git Makefile premake4.lua src
c2play-x11 LICENSE.txt odroid.c2.video.helper README

- The content of the odroid.c2.video.helper folder is:
roid@odroid64:~/c2play/odroid.c2.video.helper$ ls -A
app .git host README.md release

- Can you also redo the plugin installation as described in the first post? --Yes, I did it again using the following three commands:

odroid@odroid64:~$ git clone https://github.com/mad-ady/odroid.c2.video.helper.git
Cloning into 'odroid.c2.video.helper'...
remote: Counting objects: 53, done.
remote: Total 53 (delta 0), reused 0 (delta 0), pack-reused 53
Unpacking objects: 100% (53/53), done.
Checking connectivity... done.

odroid@odroid64:~$ cd odroid.c2.video.helper/
odroid@odroid64:~/odroid.c2.video.helper$ sudo apt-get install libjson-perl libproc-background-perl libconfig-simple-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
libjson-perl is already the newest version (2.90-1).
libconfig-simple-perl is already the newest version (4.59-6).
libproc-background-perl is already the newest version (1.10-1).
The following packages were automatically installed and are no longer required:
libcec4 libenca0 libguess1 libhdhomerun2 libllvm3.8 libmircommon5 libnfs8
libp8-platform2 librubberband2v5 libsdl2-2.0-0 libsndio6.1 libva-wayland1
linux-tools-4.4.0-65 linux-tools-4.4.0-65-generic mpv rtmpdump snap-confine
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

- I have not re-installed the plugin again inside chrome because it has been already installed there from the previous attempts.
Still not working.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Sun Aug 06, 2017 8:08 pm

Can you try to reinstall the plugin, especially this step?
Code: Select all
cd ~/odroid.c2.video.helper/host
bash install_host.sh


You should be able to get debugging output with this command (start it before playing the video):
Code: Select all
$ sudo journalctl -f | grep odroid.c2.video.helper
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Read configuration from /home/adrianp/.odroid.c2.video.helper.conf
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Config contains: $VAR1 = {'general.playerdebug' => '1','general.player' => '/usr/local/bin/c2play-x11','youtu.extraArgs' => '-f 22 --no-playlist','general.debug' => 1};
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Listening for a message
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Received message {"url":"https://www.youtube.com/watch?v=EKbWvGLC97Q","type":"page"}
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: $VAR1 = \{'type' => 'page','url' => 'https://www.youtube.com/watch?v=EKbWvGLC97Q'};
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Extracting youtube-dl link
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Extracted domain www.youtube.com
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Looking at config section general
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Looking at config section general
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Looking at config section youtu
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: domain www.youtube.com matches base youtu
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Looking at config section general
Aug 06 14:04:16 bellatrix odroid.c2.video.helper[5590]: Extracting with command /usr/local/bin/youtube-dl -g -f 22 --no-playlist 'https://www.youtube.com/watch?v=EKbWvGLC97Q'
Aug 06 14:04:27 bellatrix odroid.c2.video.helper[5590]: Found real URL via youtube-dl: https://r3---sn-gqn-vu2s.googlevideo.com/videoplayback?key=yt6&mime=video%2Fmp4&dur=1191.090&expire=1502039064&ratebypass=yes&requiressl=ye
s&initcwndbps=3200000&source=youtube&ei=uPeGWZpOzY9X4MC88Ak&lmt=1500315443265160&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexp
ire&ipbits=0&id=o-AJ6pz7t_xRhdWUK0OmSC3MRt3ddpgZ83wDJAcXfYyz79&mv=m&mt=1502017356&ms=au&pcm2cms=yes&mn=sn-gqn-vu2s&ip=2a02%3A2f01%3A5060%3A1a44%3Ad8ee%3A9afa%3Af30f%3Ac87&mm=31&itag=22&pl=36&signature=17C2F28D788591CE6E6703914
51E149401A91A54.0CA0D13B45AE2CFE23FAB25F619AB810E25C6A66
Aug 06 14:04:27 bellatrix odroid.c2.video.helper[5590]: Starting player with cmdline: /usr/local/bin/c2play-x11 'https://r3---sn-gqn-vu2s.googlevideo.com/videoplayback?key=yt6&mime=video%2Fmp4&dur=1191.090&expire=1502039064&ra
tebypass=yes&requiressl=yes&initcwndbps=3200000&source=youtube&ei=uPeGWZpOzY9X4MC88Ak&lmt=1500315443265160&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2
Crequiressl%2Csource%2Cexpire&ipbits=0&id=o-AJ6pz7t_xRhdWUK0OmSC3MRt3ddpgZ83wDJAcXfYyz79&mv=m&mt=1502017356&ms=au&pcm2cms=yes&mn=sn-gqn-vu2s&ip=2a02%3A2f01%3A5060%3A1a44%3Ad8ee%3A9afa%3Af30f%3Ac87&mm=31&itag=22&pl=36&signature
=17C2F28D788591CE6E670391451E149401A91A54.0CA0D13B45AE2CFE23FAB25F619AB810E25C6A66' 2>&1
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Sun Aug 06, 2017 8:35 pm

I re-installed the plugin and opened the debugging before playing the 'https://www.youtube.com/watch?v=EKbWvGLC97Q' video:

odroid@odroid64:~/Downloads$ sudo journalctl -f | grep odroid.c2.video.helper/

Unfortunately still nothing. No problem to play this video with c2play once it was downloaded it on my Odroid-C2 flash.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Sun Aug 06, 2017 10:56 pm

If you don't get any output then the browser has not registered (nor started) the backend component. I will test it tomorrow, but what chrome/kernel version are you running?
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Mon Aug 07, 2017 6:31 am

I am using Chromium Version 59.0.3071.109 (Developer Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit).

The kernel version is 3.14.79-115:

odroid@odroid64:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
odroid@odroid64:~$ uname -a
Linux odroid64 3.14.79-115 #1 SMP PREEMPT Mon Jul 10 12:13:00 BRT 2017 aarch64 aarch64 aarch64 GNU/Linux
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Mon Aug 07, 2017 4:48 pm

Yup - found the problem. I forgot to add a semicolon on a line I added 8 months ago. :) It seems that nobody downloaded this project since then - which means it's not very popular :(

I fixed it and uploaded it to github.
To get it you'll need to redo these steps:
Code: Select all
$ rm -rf odroid.c2.video.helper
$ git clone https://github.com/mad-ady/odroid.c2.video.helper.git
$ cd odroid.c2.video.helper/host
$ bash install_host.sh

And then restart chrome and - it should now work as before.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Mon Aug 07, 2017 8:45 pm

Yes, you fixed it. :). It worked for me from the first attempt after I applied the suggested steps. I can enjoy now watching Despicable and Voltaj on full screen without any slowness. But, I still can't see anything when running debugging:

odroid@odroid64:~$ sudo journalctl -f | grep odroid.c2.video.helper/

It should be useful to see the debugging information.

Your statement "It seems that nobody downloaded this project since then - which means it's not very popular" makes me very sad. Your solution to get accelerated playback from the browser is a clever solution. I am more than delighted to use C2 as a desktop computer. I can watch now again videos from the Chromium browser without facing slowness. But, the most important thing for me is I can watch my movie collection stored on an external HDD connected to a Raspberry configured for NAS using c2player. I am wondering how people can watch movies on Odroid-C2 using VLC media player on full screen :o . For me it just does not work. So, c2play is the way to go.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby meveric » Mon Aug 07, 2017 8:51 pm

raduj wrote:I am wondering how people can watch movies on Odroid-C2 using VLC media player on full screen :o . For me it just does not work. So, c2play is the way to go.

Probably not many, since VLC sucks under ARM as it is. That's why you use ffplay or mpv which works way better ;)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 7512
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: ODROID-X2,ODROID-U2,ODROID-U3,ODROID-XU-Lite, ODROID-XU3, ODROID-XU3-Lite, ODROID-C1, ODROID-XU4, ODROID-C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Mon Aug 07, 2017 10:17 pm

You have an extra / in your command. Try:
Code: Select all
sudo journalctl -f | grep odroid.c2.video.helper
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Tue Aug 08, 2017 6:25 am

It's all good now. My typo mistake.

This Youtube video "https://www.youtube.com/watch?v=LJ7qXHjxj_0" used to work months ago when I implemented video playback. Not anymore now. The debbuging output is below:

odroid@odroid64:~$ sudo journalctl -f | grep odroid.c2.video.helper
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Read configuration from /home/odroid/.odroid.c2.video.helper.conf
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Config contains: $VAR1 = {'youtu.direct' => '0','general.debug' => 1,'general.player' => '/usr/local/bin/c2play-x11','general.playerdebug' => '1','youtu.extraArgs' => '-f 22 --no-playlist'};
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Listening for a message
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Received message {"url":"https://www.youtube.com/watch?v=LJ7qXHjxj_0","type":"page"}
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: $VAR1 = \{'url' => 'https://www.youtube.com/watch?v=LJ7qXHjxj_0','type' => 'page'};
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Extracting youtube-dl link
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Extracted domain http://www.youtube.com
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Looking at config section youtu
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: domain http://www.youtube.com matches base youtu
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Looking at config section general
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Looking at config section general
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Looking at config section general
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Looking at config section youtu
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: domain http://www.youtube.com matches base youtu
Aug 08 07:23:47 odroid64 odroid.c2.video.helper[14390]: Extracting with command /usr/local/bin/youtube-dl -g -f 22 --no-playlist 'https://www.youtube.com/watch?v=LJ7qXHjxj_0'
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby gseaman » Tue Aug 08, 2017 7:24 am

I've built c2play for my C1+ and would like to use this awesome tool you've created, but I use Firefox, not Chrome or Chromium. Since the idea came from a Firefox user, is the add-on portable?
gseaman
 
Posts: 83
Joined: Fri Jan 01, 2016 2:42 pm
Location: WA, USA
languages_spoken: english
ODROIDs: c1+

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Tue Aug 08, 2017 3:02 pm

@raduj:
Here's why it's not working:
Code: Select all
youtube-dl  -f 22 --no-playlist https://www.youtube.com/watch?v=LJ7qXHjxj_0
WARNING: Assuming --restrict-filenames since file system encoding cannot encode all characters. Set the LC_ALL environment variable to fix this.
[youtube] LJ7qXHjxj_0: Downloading webpage
[youtube] LJ7qXHjxj_0: Downloading video info webpage
[youtube] LJ7qXHjxj_0: Extracting video information
[youtube] LJ7qXHjxj_0: Downloading js player vflIVpVc9
[youtube] LJ7qXHjxj_0: Downloading MPD manifest
ERROR: requested format not available

It tries to download it with quality 22 which is 720p. I could ask for available qualities and select one that plays (mp4 not webm), but it would take several seconds longer for every clip. So I implemented forced quality, by having -f 22 in the parameters.
I could try to catch this error and fall back to the best quality available and hope for the best...

@gseaman: I don't think Firefox has a similar api where a plugin can extract information from a page and pass it to an external process. But if it does, I'd like to take a look at it...
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Tue Aug 08, 2017 4:33 pm

@raduj: I've made some changes to the backend to do a fallback in case you want to play a video which doesn't have the quality you ask for (720p by default). It will try to get 720p, if it fails it lists available formats (mp4) and selects the best one and plays that instead. This all happens in the backend and takes about 25s on my C2 before playback begins.
Give it a try by redownloading the git and reinstalling the host script.
Code: Select all
$ rm -rf odroid.c2.video.helper
$ git clone https://github.com/mad-ady/odroid.c2.video.helper.git
$ cd odroid.c2.video.helper/host
$ bash install_host.sh


With this I was able to play your clip. Let me know how it goes or if I broke anything else.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Tue Aug 08, 2017 5:01 pm

It's working fine now. It looks like you have not broken anything. :D

Thank you for your quick fix. I really hope more people will discover the power of your project. :D It's so convenient to spend a few dollars on buying an Odroid-C2, install some additional packages and connect the small box to a good monitor (I have got a Dell UH). The image on my monitor with Odroid-C2 is pretty much the same when connecting a MacBook Pro 2016 to the same Dell monitor U2515H.

Would you have any clue what keys to use to adjust the volume when using c2play?. The volume button on my Dell AC511 USB sound bar does not do anything as long as a video/movie is played with c2play.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Tue Aug 08, 2017 5:13 pm

You'll have to ask @crashoverride, but most likely those keys need to be able to change volume within X11 and c2play will use the same volume. It may depend wether c2play uses alsa or pulseaudio.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Wed Aug 09, 2017 5:08 pm

I will do that. You did a great job. Thank you.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Wed Aug 09, 2017 8:05 pm

I forgot to mention that there is no sound when playing this Youtube video "https://www.youtube.com/watch?v=LJ7qXHjxj_0" with c2player even I preset the volume to a certain level before opening the video. No problem with the sound with the DESPICABLE video.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Wed Aug 09, 2017 8:12 pm

Hmm, when I select the best available mp4 video for that clip I get a DASH file.
But it seems I was not paying attention and the stream is video only (quality 135):
Code: Select all
160          mp4        192x144    DASH video   86k , avc1.4d400c, 30fps, video only, 3.08MiB
133          mp4        320x240    DASH video  207k , avc1.4d400d, 30fps, video only, 6.92MiB
134          mp4        480x360    DASH video  480k , avc1.4d401e, 30fps, video only, 15.61MiB
135          mp4        640x480    DASH video  880k , avc1.4d401e, 30fps, video only, 29.29MiB
18           mp4        480x360    medium , avc1.42001E, mp4a.40.2@ 96k

I will need to select quality 18, which is lower, but it has audio + video instead.
I'll post back when I make the update.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Wed Aug 09, 2017 8:51 pm

It should be fixed (but untested). Redo these steps and report back, please:
Code: Select all
$ rm -rf odroid.c2.video.helper
$ git clone https://github.com/mad-ady/odroid.c2.video.helper.git
$ cd odroid.c2.video.helper/host
$ bash install_host.sh
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Wed Aug 09, 2017 9:13 pm

It's working now. I can hear the sound now.
The only outstanding issue now is I can't play this video with c2play once it was downloaded it on my Odroid-C2 flash.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby mad_ady » Wed Aug 09, 2017 10:37 pm

It should play locally as well. The only difference is I'm calling c2play-x11 with a URL and you're calling it with a path to a file. Test that youtube-dl downloaded the correct format with mediainfo, or try playing the file with some other player on a different device.
User avatar
mad_ady
 
Posts: 2177
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: [Howto] Accelerated video playback with Chrome plugin

Unread postby raduj » Thu Aug 10, 2017 4:44 pm

You are right. It's working now. I was trying to play that video with the wrong format, .webm. Somehow that video file was downloaded with two different formats, one with .mkv and one with .webm. It's all good now for the time being. Thank you again for your great work.
raduj
 
Posts: 34
Joined: Wed Dec 07, 2016 6:24 pm
languages_spoken: english
ODROIDs: N/A


Return to Ubuntu (All Linux'es)

Who is online

Users browsing this forum: No registered users and 2 guests