EricTheMagician / node-gdrive-fuse

This is a simple filesystem written in NodeJS to mount Google Drive as a local drive.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Suggestion] - Add support for multiple video formats in directory listings

wnielson opened this issue · comments

Google Drive creates multiple formats for each video uploaded. For example, a 1080p video will be converted into formats such as:

  • 1080p - MP4 - h.264/aac
  • 720p - MP4 - h.264/aac
  • 480p - flv - h.264/aac
  • 360p - flv - h.264/aac
  • 360p - MP4 - h.264/aac
  • 360p - WebM - VP8/vorbis

I'd be really cool to have an option to list these alternative formats next to the original. Using the examples from above, the following files could be shown when listing the directory containing the original video "video.mkv":

  • video.mkv
  • video-1080p.mp4
  • video-720p.mp4
  • video-480p.flv
  • video-360p.flv
  • video-360p.mp4
  • video-360p.webm

This functionality exists in the Kodi (XBMC) gdrive plugin, the code for which is contained here (in python), so this could be relatively easily ported over.

Additionally, Plex already has support for multi-format videos, so this would work really well for anyone using Google Drive in combo with Plex as it would reduce transcoding and bandwidth demands in many situations.

That's pretty sweet. I never knew that it was an option.
The only caveat I see right now is that it's not exposed in the Google
Drive API, but maybe in some other api. I'll have to investigate.

Eric

On Wed, May 27, 2015 at 2:30 PM, Weston notifications@github.com wrote:

Google Drive creates multiple formats for each video uploaded. For
example, a 1080p video will be converted into formats such as:

  • 1080p - MP4 - h.264/aac
  • 720p - MP4 - h.264/aac
  • 480p - flv - h.264/aac
  • 360p - flv - h.264/aac
  • 360p - MP4 - h.264/aac
  • 360p - WebM - VP8/vorbis

I'd be really cool to have an option to list these alternative formats
next to the original. Using the examples from above, the following files
could be shown when listing the directory containing the original video
"video.mkv":

  • video.mkv
  • video-1080p.mp4
  • video-720p.mp4
  • video-480p.flv
  • video-360p.flv
  • video-360p.mp4
  • video-360p.webm

This functionality exists in the Kodi (XBMC) gdrive plugin, the code for
which is contained here
https://github.com/ddurdle/XBMC-gdrive/blob/master/resources/lib/gdrive.py#L616
(in python), so this could be relatively easily ported over.

Additionally, Plex already has support
https://support.plex.tv/hc/en-us/articles/200381043-Multi-Version-Movies
for multi-format videos, so this would work really well for anyone using
Google Drive in combo with Plex as it would reduce transcoding and
bandwidth demands in many situations.


Reply to this email directly or view it on GitHub
#59.

+1 to this - this looks excellent

The only thing though with XBMC would be that I think it would make
seperate entries for each video files if you scan it into the library -
it does not merge them into 1 entry like Plex does.

thejinx0r wrote:

That's pretty sweet. I never knew that it was an option.
The only caveat I see right now is that it's not exposed in the Google
Drive API, but maybe in some other api. I'll have to investigate.

Eric

On Wed, May 27, 2015 at 2:30 PM, Weston notifications@github.com wrote:

Google Drive creates multiple formats for each video uploaded. For
example, a 1080p video will be converted into formats such as:

  • 1080p - MP4 - h.264/aac
  • 720p - MP4 - h.264/aac
  • 480p - flv - h.264/aac
  • 360p - flv - h.264/aac
  • 360p - MP4 - h.264/aac
  • 360p - WebM - VP8/vorbis

I'd be really cool to have an option to list these alternative formats
next to the original. Using the examples from above, the following files
could be shown when listing the directory containing the original video
"video.mkv":

  • video.mkv
  • video-1080p.mp4
  • video-720p.mp4
  • video-480p.flv
  • video-360p.flv
  • video-360p.mp4
  • video-360p.webm

This functionality exists in the Kodi (XBMC) gdrive plugin, the code for
which is contained here

https://github.com/ddurdle/XBMC-gdrive/blob/master/resources/lib/gdrive.py#L616
(in python), so this could be relatively easily ported over.

Additionally, Plex already has support

https://support.plex.tv/hc/en-us/articles/200381043-Multi-Version-Movies
for multi-format videos, so this would work really well for anyone using
Google Drive in combo with Plex as it would reduce transcoding and
bandwidth demands in many situations.


Reply to this email directly or view it on GitHub
#59.


Reply to this email directly or view it on GitHub
#59 (comment).

--Saqeb

I've been playing around with this a bit. Once you're authenticated, you can get a list of formats by querying:

https://docs.google.com/get_video_info?docid=<DOC_ID>

From here it is just a simple matter of parsing the response text to get available videos. The code to do this is actually pretty straightforward, albeit a bit ugly.

@saqebakhter, it looks like you're right--Kodi/XBMC doesn't appear to support multiple resolutions per file. I don't see a clear solution here except to either 1) disable this feature for directories in which you are using Kodi or 2) define which alternative resolution to prefer over the original and only show that one. Also, if you're using both Plex and Kodi, you could always have two different mount points--one with alternative video lists and the other without.

@wnielson the 2nd option would probably work best with a config.json setting to enable/disable this feature -- granted @thejinx0r implements it

After the @thejinx0r the recent bag of fixes that have been done my setup is actually quite stable now.

I'm not well versed in CoffeeScript, but I've managed to whip up a working function for retrieving a list of alternate videos for a given docid that piggybacks off of the Google Drive OAuth2 credentials. The gist is here and can be used simply (from the src directory):

get_alternate_videos "0B0gj7M1ZrIjWdDZYLUdoSmdabcdE", (videoList) ->
    console.log videoList

Which will output something like:

Found 7 alternate videos
[ { quality: 'hd1080',
    width: '1920',
    height: '1080',
    codec: 'h.264/aac',
    container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
    extension: 'mp4',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
  { quality: 'hd720',
    width: '1280',
    height: '720',
    codec: 'h.264/aac',
    container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
    extension: 'mp4',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
  { quality: 'large',
    width: '854',
    height: '480',
    codec: 'h.264/aac',
    container: 'x-flv',
    extension: 'flv',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
  { quality: 'medium',
    width: '640',
    height: '360',
    codec: 'h.264/aac',
    container: 'x-flv',
    extension: 'flv',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
  { quality: 'medium',
    width: '640',
    height: '360',
    codec: 'h.264/aac',
    container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
    extension: 'mp4',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
  { quality: 'medium',
    width: '640',
    height: '360',
    codec: 'h.264/aac',
    container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
    extension: 'mp4',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
  { quality: 'medium',
    width: '640',
    height: '360',
    codec: 'VP8/vorbis',
    container: 'webm',
    extension: 'webm',
    url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' } ]

The url in each item can be used directly to access the video. For example, you can just copy and paste it into the browser and it'll start playing (even for private videos). I believe the URL is time-limited. Seeking is also supported via the Range: bytes=... header.

Cool. I think I've got what I need. I may or may not have time to get this
working, but I will play around.

I've been working on getting a different file watch going so that it
doesn't hog so much cpu.
On May 27, 2015 7:16 PM, "Weston" notifications@github.com wrote:

I'm not well versed in CoffeeScript, but I've managed to whip up a working
function for retrieving a list of alternate videos for a given docid that
piggybacks off of the Google Drive OAuth2 credentials. The gist is here
https://gist.github.com/wnielson/bed435005c0bd338e672 and can be used
simply (from the src directory):

get_alternate_videos "0B0gj7M1ZrIjWdDZYLUdoSmdabcdE", (videoList) ->
console.log videoList

Which will output something like:

Found 7 alternate videos
[ { container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
quality: 'hd1080',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
{ container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
quality: 'hd720',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...'},
{ container: 'x-flv',
quality: 'large',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
{ container: 'x-flv',
quality: 'medium',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
{ container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
quality: 'medium',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
{ container: 'mp4;+codecs="avc1.42001E,+mp4a.40.2"',
quality: 'medium',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' },
{ container: 'webm',
quality: 'medium',
url: 'https://r1---sn-p5qlsnsd.c.docs.google.com/videoplayback?...' } ]


Reply to this email directly or view it on GitHub
#59 (comment)
.

@thejinx0r awesome on both accounts. I'm very motivated to get his feature implemented, so let me know if I can help in anyway.

Do you guys have any thoughts on how you would like to browse the files in the filesystem?

What I was thinking of was to have a it in the same folder as the original file.
So, it would like like

/original_file.mkv
/original_file-hdquality1-codec.extension
/original_file-hdquality2-codec.extension
...

Additionally, I could filter out the flv and webm formats since they aren't that useful.
So it seems like there would only be mp4's that would be around.

This would be pretty amazing for mobile devices like tables and phones, which should be able to play those mp4's natively.

Yes that works I think plex should pick those automatically and not
transcode then as most plex clients will need mp4
On Sep 6, 2015 9:36 AM, "Eric Yen" notifications@github.com wrote:

Do you guys have any thoughts on how you would like to browse the files in
the filesystem?

What I was thinking of was to have a it in the same folder as the original
file.
So, it would like like

/original_file.mkv
/original_file-hdquality1-codec.extension
/original_file-hdquality2-codec.extension
...

Additionally, I could filter out the flv and webm formats since they
aren't that useful.
So it seems like there would only be mp4's that would be around.

This would be pretty amazing for mobile devices like tables and phones,
which should be able to play those mp4's natively.


Reply to this email directly or view it on GitHub
#59 (comment)
.

I would do: filename-resolution.mp4. So, for example,

filename-720p.mp4
filename-320p.mp4

I agree that a filter would be nice--MP4 is the most useful.

Also one thing I would request is that this feature be enabled or disabled
from config.json
On Sep 6, 2015 6:36 PM, "Weston Nielson" notifications@github.com wrote:

I would do: filename-resolution.mp4. So, for example,

filename-720p.mp4
filename-320p.mp4

I agree that a filter would be nice--MP4 is the most useful.


Reply to this email directly or view it on GitHub
#59 (comment)
.

I completely agree with that.
I was also going to add a configurable filter the config for which files should be scanned.

And maybe in the future, which folders should be scanned as well.

commented

+1 for this - would be super awesome with plex!