Open vredesbyyrd opened 3 years ago
Hello! I don't have any initial ideas about why this wouldn't work sorry. Is the media that fails always bluerays with the container changed as mp4
, and do any of them work?
Just doing an initial google it looks like those error messages indicate the media isn't supported on the chromecast https://developers.google.com/cast/docs/web_receiver/error_codes.
Does the default ffmpeg
built into the chromecast work if you pass in the original blueray media (without being converted to mp4)? By default it uses the following, I haven't tried it out with blueray but it worked with some other media formats: https://github.com/vishen/go-chromecast/blob/master/application/application.go#L1038-L1047
$ go-chromecast -v load <path/to/blueray>
Thanks for the link and info.
EDIT: I wrote this before having any tea. I closer look at the supported media types show that the file in my example uses an mp4 non-compliant audio media type
, HE-AAC
.
https://developers.google.com/cast/docs/media#mp4_non-compliant_audio_media_types
EDIT 2: uhg, sorry. I think I misunderstood. mp4 non-compliant audio media type
is specific to audio only files i believe. 'HE-AAC` is compliant for audio/video. At least, I can play other video files with that audio type without issue. As i said don't know much about codecs etc.
FINAL EDIT: the files that wont play have had there container changed from mkv
-> mp4
but contain audio with more than 2 channels. Which is a no go, as pointed out in application.go
ffmpeg
function. I converted the test file to ac 2
and it works.
Hello! I don't have any initial ideas about why this wouldn't work sorry. Is the media that fails always bluerays with the container changed as mp4, and do any of them work?
Correct, always files with there container changed to mp4
. But some of the changed files work fine and without requiring any transcoding. Looking at the links you sent of acceptable media types and comparing mediainfo
output I have not been able to find any discrepancies or what would be causing some files to work while others fail. Although I am nowhere near an expert with this stuff.
But i figured one thing out. If I change the container back to mkv:
ffmpeg -i '/home/clu/Media/Interim/tmp-tv/S01E01 - Emergency Landing in Tehran.mp4' -c:v copy -c:a copy '/home/clu/Media/Interim/tmp-tv/S01E01 - Emergency Landing in Tehran.mkv'
Then load:
go-chromecast load '/home/clu/Media/Interim/tmp-tv/S01E01 - Emergency Landing in Tehran.mkv' -u 0f2aadf484fe4437746f3515ea0e2133
The file successfully plays and I can see that ffmpeg
is transcoding ... ps aux | grep ffmpeg
ffmpeg -re -i /home/clu/Media/Interim/tmp-tv/S01E01 - Emergency Landing in Tehran.mkv -vcodec h264 -acodec aac -ac 2 -f mp4 -movflags frag_keyframe+faststart -strict -experimental pipe:1
Now I wonder if there is sane way around this. My original plan when buying a chromecast was to implement it into my "rofi media browser" gui. Its just a simple UI to quickly choose local media to play via mpv. But go-chromecast
seems like the perfect tool to optionally send a selection to chromecast.
If there any way to fallback and attempt to transcode if the file fails to play and the container is mp4
? Apologies if thats a stupid question.
So I wrote a little script to convert any files that are not 2 channel audio, which turns out to be less than 20% of my media. That way, If I am not overlooking anything, all or the vast majority of files wont require any transcoding. Works for me.
I'll close this. Thanks again for the help.
Apologies I couldn't be more help, glad you got it working though!
If there any way to fallback and attempt to transcode if the file fails to play and the container is mp4? Apologies if thats a stupid question.
There currently isn't any way to do this, but we could add a flag to do this fallback if that would be helpful/
There currently isn't any way to do this, but we could add a flag to do this fallback if that would be helpful/
I could see that being helpful, but only if its not too much trouble for you to add as a feature. I am choosing to convert everything ahead of time because I much prefer the ability to seek. But it would be nice to have a flag to "fallback and attempt to transcode on failure".
Lastly, I know I am not alone in wrapping mkv
in mp4
container. So I would assume at some point other users will run into the same "isssue".
Hope I am not being a thorn in your side, but I did run into something else. The following file will not play on go-chromecast
but plays without issue with castnow
. go-chromecast
returns a 104
error.
go-chromecast -v load '/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4' -u 0f2aadf484fe4437746f3515ea0e2133
INFO[0000] using device name=Living Room TV addr=192.168.1.108 port=8009 uuid=0f2aadf484fe4437746f3515ea0e2133
DEBU[0000] (1)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":1} package=cast
DEBU[0000] (2)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.receiver]: {"type":"GET_STATUS","requestId":2} package=cast
DEBU[0000] (2)sender-0 <- receiver-0 [urn:x-cast:com.google.cast.receiver]: {"requestId":2,"status":{"applications":[{"appId":"CC1AD845","displayName":"Default Media Receiver","iconUrl":"","isIdleScreen":false,"launchedFromCloud":false,"namespaces":[{"name":"urn:x-cast:com.google.cast.cac"},{"name":"urn:x-cast:com.google.cast.debugoverlay"},{"name":"urn:x-cast:com.google.cast.broadcast"},{"name":"urn:x-cast:com.google.cast.media"}],"sessionId":"997380ae-e5ec-4270-a187-f1fe9fc46dac","statusText":"Default Media Receiver","transportId":"997380ae-e5ec-4270-a187-f1fe9fc46dac","universalAppId":"CC1AD845"}],"userEq":{},"volume":{"controlType":"attenuation","level":1.0,"muted":false,"stepInterval":0.05000000074505806}},"type":"RECEIVER_STATUS"} package=cast
DEBU[0000] (3)sender-0 -> 997380ae-e5ec-4270-a187-f1fe9fc46dac [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":3} package=cast
DEBU[0000] (4)sender-0 -> 997380ae-e5ec-4270-a187-f1fe9fc46dac [urn:x-cast:com.google.cast.media]: {"type":"GET_STATUS","requestId":4} package=cast
DEBU[0000] (4)sender-0 <- 997380ae-e5ec-4270-a187-f1fe9fc46dac [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[],"requestId":4} package=cast
INFO[0000] local IP address: 192.168.1.113 package=application
INFO[0000] starting streaming server... package=application
INFO[0000] trying to find available port to start streaming server on package=application
INFO[0000] found available port :45037 package=application
INFO[0000] started streaming server package=application
INFO[0000] media server listening on 45037 package=application
DEBU[0000] (5)sender-0 -> 997380ae-e5ec-4270-a187-f1fe9fc46dac [urn:x-cast:com.google.cast.media]: {"type":"LOAD","requestId":5,"media":{"contentId":"http://192.168.1.113:45037?media_file=/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4\u0026live_streaming=false","contentType":"video/mp4","streamType":"BUFFERED","duration":0,"metadata":{"metadataType":0,"artist":"","title":"","subtitle":"","images":null,"releaseDate":""}},"currentTime":0,"autoplay":true,"queueData":{"startIndex":0},"customData":null} package=cast
DEBU[0000] (-1)* <- 997380ae-e5ec-4270-a187-f1fe9fc46dac [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[{"mediaSessionId":2,"playbackRate":1,"playerState":"IDLE","currentTime":0,"supportedMediaCommands":274447,"volume":{"level":1,"muted":false},"media":{"contentId":"http://192.168.1.113:45037?media_file=/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4&live_streaming=false","contentType":"video/mp4","streamType":"BUFFERED","duration":0,"metadata":{"metadataType":0,"artist":"","title":"","subtitle":"","releaseDate":""},"mediaCategory":"VIDEO"},"queueData":{"startIndex":0},"currentItemId":1,"extendedStatus":{"playerState":"LOADING","media":{"contentId":"http://192.168.1.113:45037?media_file=/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4&live_streaming=false","contentType":"video/mp4","streamType":"BUFFERED","duration":0,"metadata":{"metadataType":0,"artist":"","title":"","subtitle":"","releaseDate":""},"mediaCategory":"VIDEO"},"mediaSessionId":2},"repeatMode":"REPEAT_OFF"}],"requestId":0} package=cast
INFO[0000] canServe=false, liveStreaming=false, filename=/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode package=application
INFO[0000] method=GET, headers=map[Accept:[*/*] Accept-Encoding:[identity;q=1, *;q=0] Accept-Language:[en-US,en;q=0.9] Cast-Device-Capabilities:[{"bluetooth_supported":true,"display_supported":true,"hi_res_audio_supported":false,"remote_control_input_supported":false,"touch_input_supported":false}] Connection:[keep-alive] Range:[bytes=0-] User-Agent:[Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36 CrKey/1.49.230269]], reponse_headers=map[Content-Type:[text/plain; charset=utf-8] X-Content-Type-Options:[nosniff]] package=application
DEBU[0000] (5)sender-0 <- 997380ae-e5ec-4270-a187-f1fe9fc46dac [urn:x-cast:com.google.cast.media]: {"requestId":5,"type":"LOAD_FAILED","detailedErrorCode":104,"itemId":1} package=cast
Mediainfo:
General
Complete name : /mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 1.40 GiB
Duration : 57 min 20 s
Overall bit rate mode : Variable
Overall bit rate : 3 493 kb/s
Writing application : Lavf58.45.100
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 5 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 57 min 20 s
Bit rate mode : Variable
Bit rate : 3 359 kb/s
Maximum bit rate : 24.0 Mb/s
Width : 1 920 pixels
Height : 960 pixels
Display aspect ratio : 2.000
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.076
Stream size : 1.35 GiB (96%)
Writing library : x264 core 158 r2984
Encoding settings : cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=30 / lookahead_threads=5 / 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=239 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=3359 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=24000 / vbv_bufsize=24000 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:1.00
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Codec configuration box : avcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 57 min 20 s
Duration_LastFrame : -5 ms
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 52.6 MiB (4%)
Language : English
Default : Yes
Alternate group : 1
Are you able to provide the command you used for castnow
and any debug output it has? I'm not to familiar with how castnow
does things, but it sounds like we are passing the file straight to the chromecast to play, but maybe castnow
is detecting it isn't a playable file and transcoding it somehow?
I initially assumed that castnow
must be transcoding, but i cannot find any evidence that it is. And it looks like castnow
requires the --tomp4
flag to transcode, ie it wont automatically fallback to transcoding. The debug output is not very verbose, perhaps because nothing is going "wrong".
DEBUG=castnow* castnow --address 192.168.1.108 '/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4'
castnow volume step: 0.05 +0ms
castnow launching... +1ms
castnow:stdin [
castnow:stdin {
castnow:stdin path: '/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4'
castnow:stdin }
castnow:stdin ] +0ms
castnow:localfile started webserver on address 192.168.1.120 using port 4100 +13ms
castnow player status: loading plugins +1ms
castnow player status: scanning +0ms
castnow player status: connecting +2ms
castnow player status: launching +305ms
castnow player status: loading +2s
castnow:localfile incoming request serving /mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4 +299ms
castnow:localfile incoming request serving /mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4 +81ms
castnow:localfile incoming request serving /mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4 +1s
castnow player status: ready +486ms
castnow player status: playing +161ms
castnow player status: buffering +188ms
castnow player status: playing +534ms
castnow player status: playing +1s
castnow key pressed: s +21s
castnow player status: idle +140ms
castnow key pressed: q +3s
I stumbled across another cli-chromecast player, catt (built with https://github.com/home-assistant-libs/pychromecast) and experimented with it a bit. From reading through comments my understanding is its not capable of transcoding, yet it can also play the same file.
catt -d 192.168.1.108 cast '/mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4'
Casting local file /mnt/TARS/Series/Devs (TV Mini-Series 2020)/S01E01 - Episode #1.1.mp4...
Playing "S01E01 - Episode #1.1" on "Living Room TV"...
Serving local file(s).
192.168.1.108 - - [10/Apr/2021 12:44:52] "GET /?loaded_from_catt HTTP/1.1" 206 - video/mp4 - 1.39 GB
192.168.1.108 - - [10/Apr/2021 12:44:52] "GET /?loaded_from_catt HTTP/1.1" 206 - video/mp4 - 1.39 GB
192.168.1.108 - - [10/Apr/2021 12:44:53] "GET /?loaded_from_catt HTTP/1.1" 206 - video/mp4 - 1.39 GB
I wish I had something useful to share with you!
First, thanks for sharing this. go-chromecast appears to be very well done!
I am having trouble getting most (i think) of my local video files to play. Here is the
mediainfo
output from the tested file, command and debug info...EDIT: (env info)
go-chromecast -v load '/mnt/TARS/Series/Tehran (2020)/S01/S01E01 - Emergency Landing in Tehran.mp4' -u 0f2aadf484fe4437746f3515ea0e2133
What jumped out to me from the above log:
This is my first time using a chromecast at all. Perhaps of note, currently I play any local video files through a bluray player via usb or budgie/gnomes media server rygel. My bluray player only accepts
mp4
files so I 'convert' everything to mp4, or more precisely change the container tomp4
to fool the bluray player into accepting the files, not sure this could be an issue forgo-chromecast
.parallel 'ffmpeg -hide_banner -loglevel panic -i {} -vcodec copy -acodec copy {.}.mp4' ::: "${FILES[@]}"
If you have any ideas on what could be going on here I would love to hear them! Thanks for your time.