Coder Social home page Coder Social logo

keredson / gnomecast Goto Github PK

View Code? Open in Web Editor NEW
1.4K 26.0 50.0 1.43 MB

Chromecast local files from Linux - supports MKV, subtitles, 5.1 sound and 4K!

License: GNU General Public License v3.0

Python 99.13% HTML 0.41% CSS 0.46%
chromecast cast python chromecast-audio google-cast video 4k

gnomecast's Introduction

alt text

Gnomecast logo

This is a native Linux GUI for casting local files to Chromecast devices. It supports:

  • Both audio and video files (anything ffmpeg can read)
  • Realtime transcoding (only when needed)
  • Subtitles (embedded and external SRT files)
  • Fast scrubbing (waiting 20s for buffering to skip 30s ahead is wrong!)
  • 4K videos on the Chromecast Ultra!

What's New

  • 1.9: Multi video/audio stream support.
  • 1.8: 5.1/7.1 surround sound E/AC3 support.
  • 1.7: Drag and drop files into the main UI.
  • 1.6: Mutiple file / queuing support.

Install

Please run:

$ sudo apt install ffmpeg python3-pip python3-gi
$ pip3 install gnomecast

If installing in a mkvirtualenv built virtual environment, make sure you include the --system-site-packages parameter to get the GTK bindings.

Run

After installing, log out and log back in. It will be in your launcher:

alt text

You can also run it from the command line:

$ gnomecast

Or:

$ python3 -m gnomecast

You can also configure the port used for the HTTP server via the environment variable GNOMECAST_HTTP_PORT:

$ GNOMECAST_HTTP_PORT=8010 python3 -m gnomecast

Please report bugs, including video files that don't work for you!

Tests

Run the tests from the commandline:

$ python3 test_gnomecast.py

My File Won't Play!

Chromecasts are picky, and the built in media receiver doesn't give any feedback regarding why it won't play something. (It just flashes and quits on the main TV.) If your file won't play, please click the info button:

image

And then the "Report File Doesn't Play" button:

image

So I can fix it!

Thanks To...

And everyone who made this project hit HN's front page and #2 on GitHub's trending list! That's so awesome!!!

alt text

Transcoding

Chromecasts only support a handful of media formats. See: https://developers.google.com/cast/docs/media

So some amount of transcoding is necessary if your video files don't conform. But we're smart about it. If you have an .mkv file with h264 video and AAC audio, we use ffmpeg to simply rewrite the container (to .mp4) without touching the underlying streams, which my XPS 13 can at around 100x realtime (it's fully IO bound).

Now if you have that same .mkv file with and A3C audio stream (which Chromecast doesn't support) we'll rewrite the container, copy the h264 stream as is and only transcode the audio (at about 20x).

If neither your file's audio or video streams are supported, then it'll do a full transcode (at around 5x).

We write the entire transcoded file to your /tmp directory in order to make scrubbing fast and glitch-free, a good trade-off IMO. Hopefully you're not running your drive at less than one video's worth of free space!

Subtitles

Chromecast only supports a handful of subtitle formats, .srt not included. But it does support WebVTT. So we extract whatever subtitles are in your video, convert them to WebVTT, and then reattach them to the video through Chomecast's API.

gnomecast's People

Contributors

0x85dotdev avatar fbartels avatar fiendish avatar hiddewie avatar jruschme avatar k3ck3c avatar keredson avatar meonwax avatar overkillguy avatar rgegriff avatar rouja avatar sdushantha avatar sohailsomani avatar yahe 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gnomecast's Issues

Video files with multiples audio tracks

Hi there! Thank you for the great job!!
But I can't figure out how to select desired audio track from a "dual audio" video file.

The file info:

$ mediainfo Mononoke\ Hime\ BD\ \(1920x1040\)\ Dual\ Audio\ 5.1\ \[rich_jc\].mkv 

General
Unique ID                                : 188748121208614031048782978348597233935 (0x8DFF90DC161677EE8196F76B1D15C90F)
Complete name                            : Mononoke Hime BD (1920x1040) Dual Audio 5.1 [rich_jc].mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 1.90 GiB
Duration                                 : 2 h 13 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 035 kb/s
Movie name                               : [rich_jc]
Encoded date                             : UTC 2015-05-30 12:22:58
Writing application                      : mkvmerge v6.5.0 ('Isn't she lovely') built on Oct 20 2013 12:50:05
Writing library                          : libebml v1.3.0 + libmatroska v1.4.1
Attachments                              : PM_1080p_12a.jpg / NotoSans-Regular.ttf / NotoSans-Bold.ttf / NotoSans-Italic.ttf / NotoSans-BoldItalic.ttf

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 5 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 13 min
Bit rate mode                            : Variable
Maximum bit rate                         : 25.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 040 pixels
Display aspect ratio                     : 16:9
Original display aspect ratio            : 1.85:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (23976/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Title                                    : x264 8bit [KoTuWa]
Writing library                          : x264 core 133 r2334 a3ac64b
Encoding settings                        : cabac=1 / ref=6 / deblock=1:1:1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=0.43:0.16 / mixed_ref=1 / me_range=52 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-3 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=1 / constrained_intra=0 / bframes=3 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=1 / keyint=240 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=24.3 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=25000 / vbv_bufsize=25000 / crf_max=0.0 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:0.70 / zones=0,10813,crf=23/185371,191876,crf=34
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : HE-AAC / LC
Format settings                          : Explicit
Codec ID                                 : A_AAC-2
Duration                                 : 2 h 13 min
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz / 24.0 kHz
Frame rate                               : 23.438 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 31 ms
Title                                    : Japanese (日本の)
Language                                 : Japanese
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : A_AAC-2
Duration                                 : 2 h 13 min
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 9 ms
Title                                    : Portuguese (Português)
Language                                 : Portuguese
Default                                  : No
Forced                                   : No

Text
ID                                       : 4
Format                                   : UTF-8
Codec ID                                 : S_TEXT/UTF8
Codec ID/Info                            : UTF-8 Plain Text
Title                                    : Portuguese (Português)
Language                                 : Portuguese
Default                                  : Yes
Forced                                   : No

Sorry if it's a dumb question.

Chromecast gives up after waiting.

This is basically a re-opening of #60 but I was pretty unresponsive on that issue and it seems like it got sidetracked into an unrelated problem. Feel free to close/reopen as desired.

Link to audio file I was trying to stream

I'm on Gnomecast 1.4.1, and uname -a is

Linux <snip> 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

The full log of opening Gnomecast from the terminal, and trying to stream the file:

★ 𝞴 gnomecast 

(gnomecast:17413): Gtk-WARNING **: Theme parsing error: gtk.css:2:0: Expected semicolon

(gnomecast:17413): Gtk-WARNING **: Theme parsing error: gtk.css:3:0: Expected semicolon

(gnomecast:17413): Gtk-WARNING **: Theme parsing error: gtk.css:4:0: Expected semicolon
No subtitles. -1 None
None
serving on http://192.168.1.40:44501
check_ffmpeg
b'/usr/bin/ffmpeg\n'
Chromecast('192.168.1.46', port=8009, device=DeviceStatus(friendly_name='XBR-49X900E', model_name='BRAVIA 4K GB', manufacturer='Sony', uuid=UUID('<snip>'), cast_type='cast'))
Open clicked
File selected: /home/pawan/439893_4397472-lq.mp3
Checking for subtitles... -1 None
WARNING:pychromecast.controllers:STOP command requested but no session is active.
subtitle_ids []
No subtitles. -1 None
Transcoder /home/pawan/439893_4397472-lq.mp3 mp3 None False
True True False
['ffmpeg', '-i', '/home/pawan/439893_4397472-lq.mp3', '-c:v', 'h264', '-c:a', 'copy', '/tmp/gnomecast_lsmyi8hh.mp4']
CastStatus(is_active_input=True, is_stand_by=False, volume_level=0.07999999821186066, volume_muted=False, app_id='CC1AD845', display_name='Default Media Receiver', namespaces=['urn:x-cast:com.google.cast.cac', 'urn:x-cast:com.google.cast.broadcast', 'urn:x-cast:com.google.cast.media'], session_id='1465485f-805d-49d0-a1a1-bf96d7b56a0c', transport_id='1465485f-805d-49d0-a1a1-bf96d7b56a0c', status_text='Default Media Receiver')
<MediaStatus {'supports_skip_backward': False, 'artist': None, 'supported_media_commands': 0, 'content_type': None, 'playback_rate': 1, 'supports_pause': False, 'volume_muted': False, 'title': None, 'current_time': 0, 'player_state': 'UNKNOWN', 'album_artist': None, 'supports_stream_volume': False, 'duration': None, 'supports_skip_forward': False, 'stream_type': 'UNKNOWN', 'subtitle_tracks': {}, 'last_updated': None, 'metadata_type': None, 'content_id': None, 'idle_reason': None, 'volume_level': 1, 'track': None, 'episode': None, 'series_title': None, 'media_session_id': None, 'supports_seek': False, 'images': [], 'supports_stream_mute': False, 'media_custom_data': {}, 'media_metadata': {}, 'season': None, 'album_name': None, 'current_subtitle_tracks': []}>

And it just hangs there.

The device is recognised correctly so I am unsure what the problem can be. I also checked the transcoded file saved in /tmp and it seemed to be fine too. Maybe I need to open up some port?

support different subtitle encoding

Due to MS Windows, many (maybe most) non-english subtitles available are not UTF-8 encoded, but instead use a local Windows codepage. In my case, 99% Czech subtitles I can find on the internet are in CP1250. All decent media players (VLC, etc) support this and allow you to set default subtitle encoding. Unfortunately it seems that gnomecast insists the subtitle file must be UTF-8 encoded (I see broken non-ascii characters when casting).

Can you please add support for specifying the subtitle file encoding, so that I don't need to recode all my subtitle files by hand?

Thanks!

gnomecast 1.4.1
Fedora 28

OSError : Cannot assign requested address

I've just installed gnomecast but when I launch it, I've got the following error :

Traceback (most recent call last):
  File "/usr/local/bin/gnomecast", line 11, in <module>
    load_entry_point('gnomecast==0.2.6', 'gui_scripts', 'gnomecast')()
  File "/usr/local/lib/python3.6/site-packages/gnomecast.py", line 719, in main
    caster = Gnomecast()
  File "/usr/local/lib/python3.6/site-packages/gnomecast.py", line 154, in __init__
    s.bind((self.ip, 0))
OSError: [Errno 99] Cannot assign requested address

Here is my environment details, if it can help :

Fedora release 27 (Twenty Seven)
NAME=Fedora
VERSION="27 (Workstation Edition)"
ID=fedora
VERSION_ID=27
PRETTY_NAME="Fedora 27 (Workstation Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:27"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=27
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=27
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation
Fedora release 27 (Twenty Seven)
Fedora release 27 (Twenty Seven)

Add support to connect directly to chromecast via IP

This is really cool. Thanks for making this!

For some reason I can't get chromecast discovery to work with my network/router, but I can figure out the IP and verify that ports 8008 and 8009 are open and I can query some info about it on port 8008 using curl.

I played around with the https://github.com/balloob/pychromecast library and can successfully build ChromeCast() object just using the IP.

Can you add support for connecting to chromecast via IP? As in something like:

gnomecast -d "192.168.1.100"

Cheers

add OSX support

I know, I know, OSX isn't supported. Guess what; with all of the prereqs installed (and the fix for High Sierra's idiotically broken hostname handling[1]), it starts and runs just fine!

EXCEPT

Traceback (most recent call last):
  File "gnomecast.py", line 775, in <module>
    main()
  File "gnomecast.py", line 772, in main
    caster.run()
  File "gnomecast.py", line 181, in run
    self.build_gui()
  File "gnomecast.py", line 333, in build_gui
    win.set_icon(self.get_logo_pixbuf(color='#000000'))
  File "gnomecast.py", line 451, in get_logo_pixbuf
    pixbuf = GdkPixbuf.Pixbuf.new_from_stream(f, None)
GLib.Error: gdk-pixbuf-error-quark: Unrecognized image file format (3)

Cool thing: comment out all calls to get_logo_pixbuf (simplest workaround), and it works like a charm.

[1] Pro tip: put your hostname in /etc/hosts at the end of the localhost line, e.g.

127.0.0.1   localhost    Fubar    Fubar.local

Package dependencies are broken (and/or prerequesits missing from README)

Trying to install into a virtualenv with pip results in:

  Using cached https://files.pythonhosted.org/packages/5e/4c/748b9cbdfe5e3cffd29e90b088a19f723ed51e00eafd4bcbec4abf089386/gnomecast-1.4.1.tar.gz
    Complete output from command python setup.py egg_info:
    No module named 'pychromecast'
    No module named 'dbus'
    
    ----------------------------------------------------------------------
    Python package "gi" (for building the GU not found.
    
    If on Debian or Ubuntu, please run:
    $ sudo apt-get install python3-gi
    
    For other distributions please look up the equivalent package.
    
    If this doesn't work, please report the error here:
    https://github.com/keredson/gnomecast
    
    Thanks! - Gnomecast
    ----------------------------------------------------------------------
    
    Traceback (most recent call last):
      File "/tmp/pip-install-f31a21kr/gnomecast/gnomecast.py", line 19, in <module>
        import pychromecast
    ImportError: No module named 'pychromecast'
    
    ----------------------------------------

The solution (for now) is:

  1. install external dependency python3-gi (it is actually suggested by the setup script if missing)
  2. pip install bottle pychromecast pydbus gnomecast (the first three should really be auto-installed)

The 'paste' distribution was not found and is required by gnomecast

Traceback (most recent call last):
  File "/usr/bin/gnomecast", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3147, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3131, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3160, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 666, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 984, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 870, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'paste' distribution was not found and is required by gnomecast

Shutting down kills other stream

Steps to reproduce:

  1. Start streaming with Gnomecast.
  2. Stop streaming with Gnomecast, but keep application on.
  3. Start streaming with another application towards the same Chromecast.
  4. Shut down Gnomecast.

Expected behaviour:
The new stream continues.

Actual behaviour:
The new stream is aborted.

Codec issue when playing video

Hey,
I'm trying to cast a video to my chromecast and I get this error when hitting play:

Exception happened during processing of request from ('192.168.1.18', 39594)
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/paste/httpserver.py", line 1085, in process_request_in_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in init
self.handle()
File "/usr/local/lib/python3.5/dist-packages/paste/httpserver.py", line 459, in handle
BaseHTTPRequestHandler.handle(self)
File "/usr/lib/python3.5/http/server.py", line 422, in handle
self.handle_one_request()
File "/usr/local/lib/python3.5/dist-packages/paste/httpserver.py", line 454, in handle_one_request
self.wsgi_execute()
File "/usr/local/lib/python3.5/dist-packages/paste/httpserver.py", line 307, in wsgi_execute
self.wsgi_write_chunk(chunk)
File "/usr/local/lib/python3.5/dist-packages/paste/httpserver.py", line 161, in wsgi_write_chunk
self.send_header(k, v)
File "/usr/lib/python3.5/http/server.py", line 512, in send_header
("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode character '\u05d4' in position 15: ordinal not in range(256)

This is the information I see when loading my video:
file.mkv mkv h264 True True False True
['ffmpeg', '-i', '/media/yehuda/folder/file.mkv', '-c:v', 'copy', '-c:a', 'mp3', '/tmp/movie_caster_p81pwax9.mp4']

Thanks.

coco didn't detect mp4 stream properly

$ ffmpeg -i Coco.2017.1080p.BluRay.x264.DTS-HD.MA.7.1-FGT.mkv 
ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.2.0-8ubuntu2)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, matroska,webm, from 'Coco.2017.1080p.BluRay.x264.DTS-HD.MA.7.1-FGT.mkv':
  Metadata:
    title           : Coco.2017.1080p.BluRay.x264.DTS-HD.MA.7.1-FGT
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-02-10T11:57:39.000000Z
  Duration: 01:45:02.01, start: 0.000000, bitrate: 10420 kb/s
    Chapter #0:0: start 0.000000, end 400.191000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 400.191000, end 521.521000
    Metadata:
      title           : 00:06:40.191
    Chapter #0:2: start 521.521000, end 673.589000
    Metadata:
      title           : 00:08:41.521
    Chapter #0:3: start 673.589000, end 860.318000
    Metadata:
      title           : 00:11:13.589
    Chapter #0:4: start 860.318000, end 1026.942000
    Metadata:
      title           : 00:14:20.318
    Chapter #0:5: start 1026.942000, end 1100.933000
    Metadata:
      title           : 00:17:06.942
    Chapter #0:6: start 1100.933000, end 1325.991000
    Metadata:
      title           : 00:18:20.933
    Chapter #0:7: start 1325.991000, end 1459.958000
    Metadata:
      title           : 00:22:05.991
    Chapter #0:8: start 1459.958000, end 1664.830000
    Metadata:
      title           : 00:24:19.958
    Chapter #0:9: start 1664.830000, end 1747.913000
    Metadata:
      title           : 00:27:44.830
    Chapter #0:10: start 1747.913000, end 1935.308000
    Metadata:
      title           : 00:29:07.913
    Chapter #0:11: start 1935.308000, end 2118.408000
    Metadata:
      title           : 00:32:15.308
    Chapter #0:12: start 2118.408000, end 2485.524000
    Metadata:
      title           : 00:35:18.408
    Chapter #0:13: start 2485.524000, end 2824.697000
    Metadata:
      title           : 00:41:25.524
    Chapter #0:14: start 2824.697000, end 3054.176000
    Metadata:
      title           : 00:47:04.697
    Chapter #0:15: start 3054.176000, end 3263.885000
    Metadata:
      title           : 00:50:54.176
    Chapter #0:16: start 3263.885000, end 3405.026000
    Metadata:
      title           : 00:54:23.885
    Chapter #0:17: start 3405.026000, end 3702.615000
    Metadata:
      title           : 00:56:45.026
    Chapter #0:18: start 3702.615000, end 3808.137000
    Metadata:
      title           : 01:01:42.615
    Chapter #0:19: start 3808.137000, end 4138.217000
    Metadata:
      title           : 01:03:28.137
    Chapter #0:20: start 4138.217000, end 4517.262000
    Metadata:
      title           : 01:08:58.217
    Chapter #0:21: start 4517.262000, end 4736.773000
    Metadata:
      title           : 01:15:17.262
    Chapter #0:22: start 4736.773000, end 4891.761000
    Metadata:
      title           : 01:18:56.773
    Chapter #0:23: start 4891.761000, end 5071.816000
    Metadata:
      title           : 01:21:31.761
    Chapter #0:24: start 5071.816000, end 5303.464000
    Metadata:
      title           : 01:24:31.816
    Chapter #0:25: start 5303.464000, end 5594.755000
    Metadata:
      title           : 01:28:23.464
    Chapter #0:26: start 5594.755000, end 5770.472000
    Metadata:
      title           : 01:33:14.755
    Chapter #0:27: start 5770.472000, end 6302.005000
    Metadata:
      title           : 01:36:10.472
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x808 [SAR 1:1 DAR 240:101], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      title           : Coco.2017.1080p.BluRay.x264.DTS-HD.MA.7.1-FGT
      BPS             : 5938201
      BPS-eng         : 5938201
      DURATION        : 01:45:02.004000000
      DURATION-eng    : 01:45:02.004000000
      NUMBER_OF_FRAMES: 151097
      NUMBER_OF_FRAMES-eng: 151097
      NUMBER_OF_BYTES : 4677821356
      NUMBER_OF_BYTES-eng: 4677821356
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-10 11:57:39
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-10 11:57:39
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 7.1, s32p (24 bit) (default)
    Metadata:
      title           : Coco.2017.1080p.BluRay.x264.DTS-HD.MA.7.1-FGT
      BPS             : 4478463
      BPS-eng         : 4478463
      DURATION        : 01:45:02.005000000
      DURATION-eng    : 01:45:02.005000000
      NUMBER_OF_FRAMES: 590813
      NUMBER_OF_FRAMES-eng: 590813
      NUMBER_OF_BYTES : 3527912696
      NUMBER_OF_BYTES-eng: 3527912696
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-10 11:57:39
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-10 11:57:39
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      title           : English-SRT
      BPS             : 68
      BPS-eng         : 68
      DURATION        : 01:34:51.726000000
      DURATION-eng    : 01:34:51.726000000
      NUMBER_OF_FRAMES: 1164
      NUMBER_OF_FRAMES-eng: 1164
      NUMBER_OF_BYTES : 48534
      NUMBER_OF_BYTES-eng: 48534
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-10 11:57:39
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-10 11:57:39
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 120x176, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      filename        : small_cover.jpg
      mimetype        : image/jpeg
    Stream #0:4: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 213x120, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      filename        : small_cover_land.jpg
      mimetype        : image/jpeg
    Stream #0:5: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 600x882, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      filename        : cover.jpg
      mimetype        : image/jpeg
    Stream #0:6: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1067x600, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      filename        : cover_land.jpg
      mimetype        : image/jpeg
At least one output file must be specified

Videos fail to report conversion rate

Loading a short (<10s) video to investigate other bugs, I got the following in my logs:

Traceback (most recent call last):
  File "/home/jiby/Documents/dev/foss/gnomecast/gnomecast.py", line 312, in f
    self.update_status()
  File "/home/jiby/Documents/dev/foss/gnomecast/gnomecast.py", line 288, in update_status
    notes.append('Converting: %i%%' % (self.transcoder.progress_seconds*100 // self.duration))
TypeError: unsupported operand type(s) for //: 'float' and 'NoneType'

I suspect the video's length is at fault, causing the update_status to be too small == None.

Probably related: after successful video playback on Chromecast, the Gnomecast GUI is frozen to ~80% of video, instead of 100%, which is not neat, and could cause users to worry about missing out a bit of video.
I'll make a PR for that separately if needed.

MKV audio track selection

I have to open up another issue right again :P

In this case, I'd like to be able to choose the audio track, as some movies have them in several languages.

Use subtitles in MKV

Hi!

It would be nice if Gnomecast would support selecting amongst the subtitles within the mkv container. As it stands now, one must first separately extract them and then manually select them.

error installing gnomecast using Ubuntu 16.04

user@box3:~$ sudo pip3 install gnomecast
[sudo] password for user:
sudo: pip3: command not found
user@box3:~$ pip3 install gnomecast
Collecting gnomecast
Using cached https://files.pythonhosted.org/packages/5e/4c/748b9cbdfe5e3cffd29e90b088a19f723ed51e00eafd4bcbec4abf089386/gnomecast-1.4.1.tar.gz
Complete output from command python setup.py egg_info:
No module named 'pychromecast'
No module named 'dbus'

----------------------------------------------------------------------
Python package "gi" (for building the GU not found.

If on Debian or Ubuntu, please run:
$ sudo apt-get install python3-gi

For other distributions please look up the equivalent package.

If this doesn't work, please report the error here:
https://github.com/keredson/gnomecast

Thanks! - Gnomecast
----------------------------------------------------------------------

Traceback (most recent call last):
File "/tmp/pip-install-i9p_iufa/gnomecast/gnomecast.py", line 19, in <module>
import pychromecast
ModuleNotFoundError: No module named 'pychromecast'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-i9p_iufa/gnomecast/
user@box3:~$ sudo apt-get install python3-gi
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-gi is already the newest version (3.20.0-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
user@box3:~$

use /var/tmp

/tmp is on many distributions a tmpfs device, only useful for storing small temporary files. Large temporary files (like a transcoded video) should not go there, but instead go to /var/tmp. Please use /var/tmp by default; or if you insist on /tmp, please detect whether /tmp is a standard dir or a tmpfs dir and adjust the behavior dynamically.

Thanks!

gnomecast 1.4.1
Fedora 28

can't cast video after audio

(Sorry for my english)
if you want to cast video after having casted audio, previous audio is casted instead of video

No dbus name found exceptions

Attempting to run gnomecast on Linux Mint using MATE desktop gives me the following:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.freedesktop.ScreenSaver': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/gnomecast", line 9, in <module>
    load_entry_point('gnomecast==0.2.15', 'gui_scripts', 'gnomecast')()
  File "/usr/local/lib/python3.4/dist-packages/gnomecast.py", line 820, in main
    caster = Gnomecast()
  File "/usr/local/lib/python3.4/dist-packages/gnomecast.py", line 185, in __init__
    saver = bus.get_object('org.freedesktop.ScreenSaver', '/ScreenSaver')
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_vname)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ScreenSaver was not provided by any .service files
 

Seems non-standard Screensaver bus location (it's hit me before on this laptop) causes an exception that is not handled.

Investigation

I'll dig into the the issue on my side of why I have no such dbus name available. That seems legitimately important for other people in my unfortunate case to try to get the correct name.
The uncaught exception is for sure an immediate issue, and I'll prepare a PR soon, but I need to understand what kind of fallback mechanism is expected if we legit can't find any Screensaver handle.

Chromecast device gives up after trying to load

I tried casting to my chromecast device (built-in, Android TV) and it seems to succeed in finding the device and connecting to it but the streaming never starts (even when no transcoding is required). Running on a KDE Neon (based on Ubuntu 16.04).

... 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Info about the video I was trying to stream (via ffmpeg -i):

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/pawan/Downloads/OT1080.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.63.104
  Duration: 00:27:49.73, start: 0.000000, bitrate: 2838 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2670 kb/s, 29.97 fps, 29.97 tbr, 10000k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 159 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

New screenshot with the new title?

Not sure if this necessary, but replacing the screen shot with the title GnomeCast with a new one would be nice because it is not called GnomeCast anymore.

Enqueue multiple video files

It would be pretty neat if I could select a couple of episodes (or an entire season) of a TV show to cast through Gnomecast.

  1. The next episode can transcode during the current one for less delay
  2. I can play multiple videos in a row without having to touch my laptop

delay reinstating screensaver

if the video is paused we reinstate the screensaver. this has an annoying property of if i pause w/ the tv remote, the screensaver immediately turns on on my laptop. we should prob. have a 10m timer to re-instate the screensaver.

Casting fails with repeated "waiting for transcode to finish" linux mint 18.3

My deepest apologies for being the sort of Linux user that knows barely enough to be dangerous, but I'm very interested in using this tool. I had some trouble with the Python 3 dependencies, but I think I worked through them--though when I finally got a working copy of gnomecast to install, I received a "failed to build wheel" error for gnomecast and several dependencies. Launching gnomecast finds my chromecast device, and I can choose an .mkv file to stream, but transcoding makes no progress (remains at zero percent) and receive endless "waiting for transcode to finish" messages in the command window. Choosing an .m4v file works as expected

Selecting file after successful stream crashes

Hi Mr owner, love your work, was able to use Chromecast natively from Linux for first time in a while!

Today's (second) error is triggered by selecting a file after having successfully streamed through an entire file. In my case I'm looking at a TV series, so I waited till end of one full episode and selected the second one.

I get the following:

Open clicked
File selected: /home/jiby/Downloads/Monkey Dust/Monkey Dust s01/Monkey Dust s01e03 (DivX 640x352).avi
WARNING:pychromecast.controllers:STOP command requested but no session is active.
WARNING:pychromecast.controllers:STOP command requested but no session is active.
Exception in thread Thread-13:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/home/jiby/Documents/dev/foss/gnomecast/gnomecast.py", line 627, in update_transcoder
    self.transcoder.destroy()
  File "/home/jiby/Documents/dev/foss/gnomecast/gnomecast.py", line 160, in destroy
    self.p.terminate()
  File "/usr/lib/python3.4/subprocess.py", line 1686, in terminate
    self.send_signal(signal.SIGTERM)
  File "/usr/lib/python3.4/subprocess.py", line 1681, in send_signal
    os.kill(self.pid, sig)

Reliably reproduced after watching another episode.

Seems we're closing a session too early somewhere because streaming succeeded, despite the application not being done running.

I'll try to trace the issue more and submit another PR.

automatically find a subtitles file with the same name as the Video

Hello

Thanks for this great tool.

If a video file and a .srt file have the same name, is it possible, after choosing the video file, to offer as default file for the subtitles, the associated subtitle file?

Example

$ ll 800*6*
-rw-r--r-- 1 gg gg 367257633 avril 16 19:30 800_Words_Series_1
-_6.Episode_6_b08vl92r_original.mp4
-rw-r--r-- 1 gg gg 88911 avril 16 19:30 800_Words_Series_1
-_6._Episode_6_b08vl92r_original.srt

If I select as video file

800_Words_Series_1_-_6._Episode_6_b08vl92r_original.mp4

and

800_Words_Series_1_-_6._Episode_6_b08vl92r_original.srt

exists, then propose this file by default.

Regards

add key bindings

clicking on the button is annoying. need:

  • space for play/pause
  • left-right arrows for fwd/rev
  • up/down for volume?

maybe hardware media keys too?

if the focus is on the button, what should we do? should we blur after click? what does that do to usability? maybe should we blur after a timeout? should we always pass the keyevent up to the parent?

Attempting to install throws error

Linux Mint 18.2
Kernel v4.15.7
HP Envy 4 core x64

sudo pip3 install gnomecast

The directory '/home/ryan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ryan/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting gnomecast
  Downloading https://files.pythonhosted.org/packages/51/d5/af6a82f39e7ecc9bf3d257511b1a67a190d6b15b31546719337f1d74a97b/gnomecast-0.2.16.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-zAjlXO/gnomecast/setup.py", line 16, in <module>
        version=__import__('gnomecast').__version__,
      File "gnomecast.py", line 57
        nonlocal timer, lastest_args, latest_kwargs
                     ^
    SyntaxError: invalid syntax
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zAjlXO/gnomecast/

Make a contribution list

Since we've got 5 people contributing to this project, I feel like it is time we put list of the contributers in the README.md

We should use this all contributors method to show the contributors of gnomecast.

implement a max height for the UI

re #59 we want to support screens sized 1024x768, and make sure our UI never grows taller than that. somehow impl a max screen height around 768, cropping the screencap if necessary.

Can't add subtitles

Hey!

I've been having problems with adding subtitles to movies. The file selection dialog opens fine, but clicking either "add" or "cancel" has no effect, and the dialog has to be closed via Alt+F4.

Gnomecast v0.3.0
Solus 3.9996
Budgie 10.4-70-g15c960cc
GNOME 3.28.1

No sound

I'm using Debian testing, I've installed gnomecast as described by a cannot hear any sound while playing a flac file to my Chromecast Audio.

setup.py and MANIFEST.in still reference cast.png

deleting cast.png broke the pip install "error: can't copy 'cast.png': doesn't exist or not a regular file" because it's still referenced.

Consider still including the logo as a file. It's useful to have one for making a .desktop file to add a Gnome shell launcher.

Progressive transcoding to start streaming immediately

I'd love to be able to make transcoding a file into a chunked process, so that we don't have to wait for the file to be completely transcoded to start streaming.
This would improve usability on big files like movies.

I know VLC has this feature on Android (and maybe even in their 3.0 release desktop), but I suspect they reimplemented completely the Chromecast controls to be able to do it.

Required steps

  1. Check the chromecast mediacontrols API for direct support of chunked streaming
  2. Change calls to ffmpeg to only transcode chunks of X seconds (one minute sounds like a good first pass)
  3. Update the scrubbing system accordingly and any other API.
  4. PR and enjoy fame and fortune

I would naturally love to help on that new feature, I'm not just complaining here :)
Any thoughts on this ?

Firewall settings

I'd like to add the appropriate rules for firewall (GUFW) but I have not been able to find any reference to the correct ports. As it currently stands, I have to disable my firewall to cast from Gnomecast or VLC3. Has anyone successfully added rules to their firewall?

Error when installing in a virtual environment: ImportError: No module named 'gi'

Got the error in the title on pip3 install gnomecast.

Traced it down to the following:
Because I first created a virtual environment with mkvirtualenv -p /usr/bin/python3 gnomecastenv, I accidentally excluded the system wide packages, including gtk and gi.
If running inside a virtual environment, system wide packages are not included by default. By building the environment with "--system-site-packages" everything works.

This is already solved, so I'm just putting this here to help any other folks trying to work it in a virtual environment.

Converting more than once

I started playback and then stopped, searched network again and started playback again. gnomecast converted my file for the second time. Would be nice to avoid that by storing a temp file with the converted content.

Oh, and thanks for the great work, it's the most convenient chromecast app I've used.

add more cmd line args

outgrowth of #24

should support:

  • --subtitles / -s
  • --device / -d (friendly name of device, "Bedroom TV", etc.)
  • --play / -p (autoplay)

license mismatch

the repo includes GPLv3 as LICENSE file, but setupy.py says "MIT License"

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.