Coder Social home page Coder Social logo

cast-localvideo's Introduction

cast-localvideo

Plays Local videos at your computer on your Chromecast. Beta for now.

Requirements

  1. A reachable Chromecast on your network, no client isolation in your router etc.
  2. Chrome Browser version 32 or later
  3. Cast extension in Chrome Store
  4. NodeJS v0.10+
  5. FFMpeg installed and reachable in PATH (Windows guide)
  6. A fast enough home interconnection network

Installation and Use

  • On a terminal, do the following:
# If you need to install FFMpeg on a mac
# libvo-aacenc is the default codec for streaming to the chromecast
$ brew install ffmpeg --with-libvo-aacenc

# OR Use "Download ZIP" button.
$ git clone https://github.com/mustafaakin/cast-localvideo.git
$ cd cast-localvideo
$ npm install
$ node app
  • In Chrome, go to http://localhost:8000. You will see your folders (just change the folder to / on Linux & Mac). There is no root concept in Windows as in Unix, so if you wish to use another drive, just use D:

  • Navigate through your folders to locate a video.

  • Select the video and you will see the metadata if it is available in the file. (It currently shows all extensions, does not check if it is really a video file)

  • Click play local to test to see if it plays on Chrome. Note that it plays very fast after some seconds, because Chrome cannot detect its length. It may be a bug, see this Stackoverflow Question to help solving this.

  • Click the "Cast to Chromecast" button to play the video on your Chromecast. It will plays normally, at its normal speed.

  • Check the terminal to see if any errors were thrown. Sometimes FFmpeg can not handle the video and as a result it will crash.

Note

I developed this on Windows, on my parents computer remotely via TeamViewer. It is not feature complete, but it is easy to add features. Any pull requests and forks are welcome.

TODOs

  1. Be able to pause/resume content.
  2. Solve the duration bug.
  3. Make use of the session feature of the Cast API to remember what is playing even if the server is down.
  4. Package it as a nice application for end users.
  5. Embed subtitles via FFMpeg.
  6. Resize the videos if they are too big.
  7. Options to change encoding options.

Contact

Contact mustafa91 at gmail for any questions. My website is here.

cast-localvideo's People

Contributors

balkian avatar edshaw avatar mathur avatar maxaf avatar mustafaakin avatar omeryl avatar reconbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cast-localvideo's Issues

Another port (in a storm)

I have port 8000 taken up (icecast2) on my ARM system I'm using. Maybe provide an option on the command line for a different port? I have a hack on a local copy but I'd rather have a proper command line handling setup in there.

POST http://localhost:8000/metadata 500 (Internal Server Error)

Chrome: 35.0.1916.153
Google Cast Extension: 14.605.0.10

Clicking "PLAY" for any media produced a 500 error (displayed in the console).

node app.js displayed:

TypeError: Cannot read property 'logger' of undefined
    at new <anonymous> (/home/test/cast-localvideo/node_modules/fluent-ffmpeg/lib/metadata.js:255:17)
    at Object.handle (/home/test/cast-localvideo/app.js:201:20)
    at next_layer (/home/test/cast-localvideo/node_modules/express/lib/router/route.js:103:13)
    at Route.dispatch (/home/test/cast-localvideo/node_modules/express/lib/router/route.js:107:5)
    at /home/test/cast-localvideo/node_modules/express/lib/router/index.js:213:24
    at Function.proto.process_params (/home/test/cast-localvideo/node_modules/express/lib/router/index.js:286:12)
    at next (/home/test/cast-localvideo/node_modules/express/lib/router/index.js:207:19)
    at next (/home/test/cast-localvideo/node_modules/express/lib/router/index.js:182:38)
    at next (/home/test/cast-localvideo/node_modules/express/lib/router/index.js:182:38)
    at next (/home/test/cast-localvideo/node_modules/express/lib/router/index.js:182:38)
POST /metadata 500 4.413 ms - 1188

Can not cast audio.

Being able to cast podcasts/audiobooks/radio plays would be a nice feature to have.

Code currently assumes everything is a video.

Errors out after selecting to play on chromecast

Trying to play a video I downloaded from Youtube.

The path is /mnt/torrents/Oney\ Videos\ -\ Pointy\ Bits\ -\ FF7\ Parody-pDqea9cWOn4.mp4

Console output. Note the server crashes after the failurre.

pi@raspberrypi ~/build/cast-localvideo $ node app
Open http://localhost:8000/ at your Chrome browser.
GET / 304 6446ms
GET /css/flatly.css 304 68ms
GET /css/main.css 304 42ms
GET /js/jquery.min.js 304 39ms
GET /js/bootstrap.js 304 37ms
GET /js/main.js 304 37ms
Error: ENOENT, no such file or directory 'C:/'
at Object.fs.readdirSync (fs.js:654:18)
at app.post.dir (/home/pi/build/cast-localvideo/app.js:27:19)
at callbacks (/home/pi/build/cast-localvideo/node_modules/express/lib/router/index.js:164:37)
at param (/home/pi/build/cast-localvideo/node_modules/express/lib/router/index.js:138:11)
at pass (/home/pi/build/cast-localvideo/node_modules/express/lib/router/index.js:145:5)
at Router._dispatch (/home/pi/build/cast-localvideo/node_modules/express/lib/router/index.js:173:5)
at Object.router (/home/pi/build/cast-localvideo/node_modules/express/lib/router/index.js:33:10)
at next (/home/pi/build/cast-localvideo/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.staticMiddleware as handle
at next (/home/pi/build/cast-localvideo/node_modules/express/node_modules/connect/lib/proto.js:193:15)
POST /files 500 67ms - 1008b
GET /fonts/glyphicons-halflings-regular.woff 304 7ms
POST /files 200 994ms - 2.64kb
POST /files 200 503ms - 381b
POST /files 200 465ms - 634b
Metadata of /mnt/torrents/Oney Videos - Pointy Bits - FF7 Parody-pDqea9cWOn4.mp4 requested
POST /metadata 200 1704ms - 730b
-i - -vcodec libx264 -acodec libvo_aacenc -ar 44100 -ac 2 -ab 128000 -f mp4 -movflags frag_keyframe+faststart pipe:1 -t 1 -fflags +genpts -re -profile baseline -level 30 -preset fast
GET /video/L21udC90b3JyZW50cy9PbmV5IFZpZGVvcyAtIFBvaW50eSBCaXRzIC0gRkY3IFBhcm9keS1wRHFlYTljV09uNC5tcDQ= 200 1160ms

events.js:72
throw er; // Unhandled 'error' event
^
Error: FFmpeg error: Unknown encoder 'libvo_aacenc'
at ChildProcess. (/home/pi/build/cast-localvideo/transcoder.js:283:28)
at ChildProcess.EventEmitter.emit (events.js:117:20)
at Process.ChildProcess._handle.onexit (child_process.js:797:12)
pi@raspberrypi ~/build/cast-localvideo $

image

Run Program Fails

Perhaps I am doing something wrong, but when I follow the instructions, I get this, on step 3
screenhunter_35 apr 01 08 44

Option to not use ffmpeg.

I have all my video encoded already for the iPhone/iPod. FFMPEG will be too slow on my ARM board I'm using as a low-power server setup (a Cubietruck). A proper option to disable using FFMPEG and just send the video/audio would be good.

Also, .m4v also works (if you change the listings).

FFMpeg error on OS X

Installed ffmpeg via homebrew, and get the following error when casting a mp4

-i - -vcodec libx264 -acodec libvo_aacenc -ar 44100 -ac 2 -ab 128000 -f mp4 -movflags frag_keyframe+faststart pipe:1 -t 1 -fflags +genpts -re -profile baseline -level 30 -preset fast
TypeError: Object #<Object> has no method 'tmpdir'
    at Transcoder._exec (/private/tmp/cast-localvideo/transcoder.js:269:12)
    at Transcoder.stream (/private/tmp/cast-localvideo/transcoder.js:313:30)
    at /private/tmp/cast-localvideo/app.js:164:4
    at callbacks (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:164:37)
    at param (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:138:11)
    at pass (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:173:4)
    at Object.router [as handle] (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:33:10)
    at next (/private/tmp/cast-localvideo/node_modules/express/node_modules/connect/lib/proto.js:193:15)
    at SendStream.error (/private/tmp/cast-localvideo/node_modules/express/node_modules/connect/node_modules/serve-static/index.js:74:37)
GET /video/L1VzZXJzL211bXJhaC9Eb3dubG9hZHMvU2hhbWVsZXNzIFVTIFMwNEUwOCBIRFRWIHgyNjQtTE9MW2V0dHZdL3NoYW1lbGVzcy51cy40MDguaGR0di1sb2wubXA0 500 9ms
-i - -vcodec libx264 -acodec libvo_aacenc -ar 44100 -ac 2 -ab 128000 -f mp4 -movflags frag_keyframe+faststart pipe:1 -t 1 -fflags +genpts -re -profile baseline -level 30 -preset fast
TypeError: Object #<Object> has no method 'tmpdir'
    at Transcoder._exec (/private/tmp/cast-localvideo/transcoder.js:269:12)
    at Transcoder.stream (/private/tmp/cast-localvideo/transcoder.js:313:30)
    at /private/tmp/cast-localvideo/app.js:164:4
    at callbacks (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:164:37)
    at param (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:138:11)
    at pass (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:173:4)
    at Object.router [as handle] (/private/tmp/cast-localvideo/node_modules/express/lib/router/index.js:33:10)
    at next (/private/tmp/cast-localvideo/node_modules/express/node_modules/connect/lib/proto.js:193:15)
    at SendStream.error (/private/tmp/cast-localvideo/node_modules/express/node_modules/connect/node_modules/serve-static/index.js:74:37)
GET /video/L1VzZXJzL211bXJhaC9Eb3dubG9hZHMvU2hhbWVsZXNzIFVTIFMwNEUwOCBIRFRWIHgyNjQtTE9MW2V0dHZdL3NoYW1lbGVzcy51cy40MDguaGR0di1sb2wubXA0 500 2ms

Media doesn't load - "Media load error" on cast

  • Windows 7 64 bit, Chrome 34 beta, cast extension 14.305.0.0,
  • The FFmpeg is reachable via PATH
  • Local cast finds the CromeCast and returns "A cast device is enabled"
  • When i select an MP4 video from my directory tree, I get this info on the video :

Resolution 1920 x 1080
Duration 00:09:56.50
Video h264 - 4421
Audio Bitrate aac - 329

  • When I click on "Cast to ChromeCast" I get the error "Media load error: [object Object]" and the cast icon shows up on the TV screen. Noting more.
  • I am using the ChromeCast test video big_buck_bunny_1080p.mp4, which normally runs well on my ChromeCast.
  • Here is the last part of the Command window (prompt) log:

Metadata of E:\PROJECTS\PROJEKT\GoogleCast\media\big_buck_bunny_1080p.mp4 reques
ted
POST /metadata 200 212ms - 585b
h264
-i - -vcodec copy -acodec libvo_aacenc -ar 44100 -ac 2 -ab 128000 -f mp4 -movfla
gs frag_keyframe+faststart pipe:1 -t 1 -fflags +genpts -re -profile baseline -le
vel 30 -preset fast
GET /video/RTpcUFJPSkVDVFNcUFJPSkVLVFxHb29nbGVDYXN0XG1lZGlhXGJpZ19idWNrX2J1bm55X
zEwODBwLm1wNA== 200 12182ms
ffmpeg process finished


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.