GithubHelp home page GithubHelp logo

alexballas / go2tv Goto Github PK

View Code? Open in Web Editor NEW
473.0 12.0 45.0 26.74 MB

Cast media files to UPnP/DLNA Media Renderers and Smart TVs.

License: MIT License

Go 99.81% Makefile 0.12% Dockerfile 0.07%
dlna-mediarenderer upnp cast samsumg-tvs videos dlna media audio video golang

go2tv's Introduction


Go2TV logo


Go Report Card Release Version Tests

Build for ARMv6 (32-bit) Build for ARMv8 (64-bit) Build for Android Build for Linux Build for MacOS Intel Build for MacOS Apple Silicon Build for Windows

Cast your media files to UPnP/DLNA Media Renderers and Smart TVs.

GUI mode

CLI mode

Parameters

$ go2tv -h
Usage of go2tv:
  -l    List all available UPnP/DLNA Media Renderer models and URLs.
  -s string
        Local path to the subtitles file.
  -t string
        Cast to a specific UPnP/DLNA Media Renderer URL.
  -tc
        Use ffmpeg to transcode input video file.
  -u string
        HTTP URL to the media file. URL streaming does not support seek operations. (Triggers the CLI mode)
  -v string
        Local path to the video/audio file. (Triggers the CLI mode)
  -version
        Print version.

Allowed media files in the GUI

  • mp4, avi, mkv, mpeg, mov, webm, m4v, mpv, mp3, flac, wav, jpg, jpeg, png

This is a GUI only limitation.

Build requirements and dependencies

  • Go v1.19+
  • ffmpeg (optional)

Build using Docker

Since the repo provides a Dockerfile, you can build a Go2TV Docker image and run it with just Docker installed (no build requirements and deps above needed). Also, no Git repo cloning is needed (Docker will do it behind the scenes). Just issue:

$ docker build --force-rm [--pull] -t go2tv github.com/alexballas/go2tv#main

Notice the branch name after the #, as the above will build main. You can also build devel if you want to build the latest code. Usage under Docker is outside this document's scope, check Docker docs for more information, specially volume mounts and networking. x11docker might come handy to run GUI mode, although it's not tested, since main Docker usage is CLI.

Quick Start

Download the app here https://github.com/alexballas/Go2TV/releases/latest. A single executable. No installation or external dependencies.

Transcoding

Go2TV supports live video transcoding, if ffmpeg is installed. When transcoding, SEEK operations are not available. Transcoding offers the maximum compatibility with the various file formats and devices. Only works with video files.

MacOS potential issues

If you get the "cannot be opened because the developer cannot be verified" error, you can apply the following workaround.

  • Control-click the app icon, then choose Open from the shortcut menu.
  • Click Open.

If you get the "go2tv is damaged and can't be opened. You should move it to the Bin." error you can apply the following workaround.

  • Launch Terminal and then issue the following command: xattr -cr /path/to/go2tv.app.

Tested on

  • Samsung UE50JU6400
  • Samsung UE65KS7000
  • Android - BubbleUPnP app

Author

Alexandros Ballas [email protected]

go2tv's People

Contributors

alexballas avatar chyroc avatar dictummortuum avatar mikescops avatar pataquets 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

go2tv's Issues

Unable to find upnp device

I tried running go2tv on an arm64 Linux device

Compilation was successful, but no upnp devices could be found during program execution

Run go2tv - l using cli

The error is as follows:

Encountered error(s): checkflags error: checkTflag service loading error: loadSSDPservices: No available Media Renderers

CLI not working on Windows?

Hello,

First, excellent work on this utility. its exactly what I want, simple and lightweight. I'm baffled how hard it has been to find something that's not some huge Media Server/SDK for simple casting.

Anyway, I cant seem to get go2tv to work at all in command line mode on Windows 10. GUI mode works just fine.

I'm able to find my device fine using
go2tv.exe -l

Results

Device 1
--------
Model: [LG] webOS TV NANO85UNA
URL:   http://192.168.50.231:1688/

Then I've tried running this from command line

go2tv.exe -t http://192.168.50.231:1839 -v c:\TheHobbit.mp4

I get this error

Encountered error(s): interactive screen error: The handle is invalid.

I've tried using a Media URL instead of a local file, get the same error.

If I use the GUI and select the same file and select the device which shows under Select Device, and hit Play, it works great

I'm wondering if I'm just missing some simple syntax. I've also tried adding -tc and made sure ffmpeg is installed but no difference.

I've tried 2 machines on my network (both Windows 10) with the same result. Any ideas?

Thanks!

It doesn't open without any clue.

I have downloaded latest release fo windows_amd64. extracted exe file, opened and nothing! Not even console appear, i also tried it run like cli in cmd, but it prints nothing and force close.
My operating system is Windows 7 7601 Max SP1, amd athlon proccessor and 2gb ram. Maybe it needs more ram to load? It really didn't give me any log text or any clue to think about. Is it possile somehow fix this? i can provide any info need :
cmd screenshot (maybe need)

[LG WebOS] Forward and backwards

Can you add the ability for forward and backwards, because it's saying that's currently disabled. But with other dlna servers its working, so i know it's something here. Other than that this program is nearly perfect.

dv files

Hello,
thank you for this great application that works perfectly.
I had a small question:
How should I proceed to play ".dv" files created by a digital camera?
Do I have to convert them first?
Or the application, via an option, would be able to play them?
Thanks for your help
Pascal

Interactive terminal option

Create an interactive terminal option to be able to invoke Play / Pause / Stop actions directly from Go2TV

Always Wating for status

i use go2tv to play the video to my JMGO-N1 Ultra Projector using

./go2tv -v 1.mkv -t http://192.168.123.34:49152/description.xml

image

every thing is ok,the video playing well and i can use keyboard to control the volume,but the status is always waiting for statusnot Playing

Playing from NAS folder (SMB share) on MacOS

Go2TV GUI on MacOS, the graphic file browser does not let me 'see' my NAS server or its folders (SMB sharing).

To see it in the MacOS finder I make invisible folders visible and the sharepoint can be found in the /Volumes folder. But in the Go2TV file browser the 'Computer' does not have a visible /Volumes folder, and I don't see a way to make it visible. How can I get to the files I want to play on my NAS?

Is it possible to mirror the screen?

Hi, there.

In my university, we've got projectors caged to the ceiling which otherwise work, except that it is very cumbersome to get cables from there.

I've got one of those cheap "Anycast" HDMI dongles that can act as a DLNA/UPnP renderer and would like to use it, instead of a long HDMI cable, to share my screen with students during a lecture. Go2TV works great for casting videos, but I couldn't figure out a way to cast/mirror my screen. Tried piping ffmpeg's x11grab output, but that didn't work ("Broken pipe"). If I dump the screen to a WebM/VP8 file and give that to Go2TV, then mirroring starts (although with some delay), but then breaks off after a few seconds.

Is there an easy way to implement this, or could you give me some pointers as to how to get this working?

Thank you very much for your work!

Bring back macOS functionality

Tried compiling this for my friends x86 MacBook with make GOOS=darwin GOARCH=amd64 but it failed on go-gl.

Maybe the GUI can be made optional for macOS?

$ make GOOS=darwin GOARCH=amd64
rm -rf ./build
go build -ldflags "-s -w -X main.build=`date -u +%Y%m%d%H%M%S` -X main.version=`cat ./version.txt` " -o build/go2tv cmd/go2tv/go2tv.go cmd/go2tv/flagfuncs.go
package command-line-arguments
        imports github.com/alexballas/go2tv/internal/gui
        imports fyne.io/fyne/v2/app
        imports fyne.io/fyne/v2/internal/driver/glfw
        imports fyne.io/fyne/v2/internal/painter/gl
        imports github.com/go-gl/gl/v3.2-core/gl: build constraints exclude all Go files in /home/damjan/go/pkg/mod/github.com/go-gl/[email protected]/v3.2-core/gl
make: *** [Makefile:4: build] Error 1

Create a GUI

Implement a crossplatform GUI.
Features, requirements

  • Video and Subtitles selection
  • Subtitles selection should be optional
  • Device selection and automated refreshes
  • Play, Pause, Stop buttons
  • Support Windows / Linux / Mac

[Request] Add audio transcoding with FFMPEG

Currently, it's only possible to transcode video media, but it will be great to do the same thing with audio for devices that only support certain types of audio.

I made an experiment with converting everything to FLAC but so far it resulted in no audio being played...

	cmd := exec.Command(
		"ffmpeg",
		"-v", "0",
		"-re",
		"-i", in,
		"-f", "flac",
		"pipe:1",
	)

wireguard

Having wireguard service running in my linux I got a:

$ go run cmd/go2tv/go2tv.go -l
Encountered error(s): checkflags error: checkTflag service loading error: LoadSSDPservices search error: write udp 0.0.0.0:55145->239.255.255.250:1900: sendmsg: required key not available
exit status 1

Only disabling wireguard with sudo wg-quick down wg0 my TV was detected and go2tv worked OK.

How to have wireguard and SSDP at the same time?
Good job with go2tv!

invalid port,ask for help

./go2tv -version
Go2TV Version: 1.4.0, Build: 20210516093811

./go2tv -l

Device 1

Model: Linux/3.14.29, UPnP/1.0, Portable SDK for UPnP devices/1.6.19
URL: http://172.16.9.84:49152/description.xml

./go2tv -v 1.mp4
Encountered error(s): parse "http://172.16.9.84:49152_urn:schemas-upnp-org:service:AVTransport_event": invalid port ":AVTransport_event" after host

target is an android TCL tv.

<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>0</minor>
    </specVersion>
    <device>
        <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
        <presentationURL>/</presentationURL>
        <friendlyName>TV(172.16.9.84)</friendlyName>
        <manufacturer>客厅极光TV(dlna)</manufacturer>
        <manufacturerURL>1</manufacturerURL>
        <modelDescription>1</modelDescription>
        <modelName>1</modelName>
        <modelURL>1</modelURL>
        <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50</dlna:X_DLNADOC>
        <UDN>uuid:be3c114f-485d-62ef-20f3-05908ee6e099</UDN>
        <serviceList>
            <service>
                <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
                <SCPDURL>/dlna/Render/AVTransport_scpd.xml</SCPDURL>
                <controlURL>_urn:schemas-upnp-org:service:AVTransport_control</controlURL>
                <eventSubURL>_urn:schemas-upnp-org:service:AVTransport_event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
                <SCPDURL>/dlna/Render/ConnectionManager_scpd.xml</SCPDURL>
                <controlURL>_urn:schemas-upnp-org:service:ConnectionManager_control</controlURL>
                <eventSubURL>_urn:schemas-upnp-org:service:ConnectionManager_event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
                <SCPDURL>/dlna/Render/RenderingControl_scpd.xml</SCPDURL>
                <controlURL>_urn:schemas-upnp-org:service:RenderingControl_control</controlURL>
                <eventSubURL>_urn:schemas-upnp-org:service:RenderingControl_event</eventSubURL>
            </service>
        </serviceList>
    </device>
    <URLBase>http://172.16.9.84:49152</URLBase>
</root>

edit file go2tv/internal/soapcalls/xmlparsers.go and rebuild (v1)

avtransportControlURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + root.Device.ServiceList.Services[i].ControlURL
avtransportEventSubURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + root.Device.ServiceList.Services[i].EventSubURL
./build/go2tv -v /tmp/1.mp4
Encountered error(s): Post "http://172.16.9.84:49152/_urn:schemas-upnp-org:service:AVTransport_control": EOF

edit file go2tv/internal/soapcalls/xmlparsers.go and rebuild (v2)

avtransportControlURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + strings.TrimLeft(root.Device.ServiceList.Services[i].ControlURL, "_")
avtransportEventSubURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + strings.TrimLeft(root.Device.ServiceList.Services[i].EventSubURL, "_")
./build/go2tv -v /tmp/1.mp4

Title: 1.mp4
Waiting for status...
Press p to Pause/Play.

but no video on tv

I read a little document about dlna, found v2 is wrong, i will test v1 later again.

add TvControl to define how to render tv control ui

define TVControl interface to define how to render tv render ui,

i define the terminal ui:

by package :

	"github.com/eiannone/keyboard"
	"github.com/gosuri/uilive"
  • keyboard to listen keyboard input, to do pause, play, volume add ...
  • uilive to show text to terminal and refresh it(not add)

image
image

and ,go2tv define two TvControl: one gui and one NewScreen

NewScreen is a full screen termianl console, I don't like full screen very much (or in some scenarios, full screen is too big)

open RTP stream and cast to renderer

Hello, would it be possible to open media through the RTP protocol ? It seems the URL opening only accepts HTTP protocol ?

I would like to live transcode local audio input into a stream and cast to a upnp renderer using go2tv

http: server closed idle connection

im trying to write a simple demo with this lib, and i call the playAction first,then call stopAction. when i call playAction again, i met err

{"level":"error","Method":"AVTransportActionSoapCall","Action":"Do POST","error":"Post \"http://192.168.123.7:49494/upnp/control/rendertransport1\": http: server closed idle connection","time":"2023-06-03T22:16:56+08:00"}

Add subtitle file failed

There is option "-s" to add subtitles file in CLI mode, but doesn't work.
I tried:

  • rename subtitle filename to the same as video filename.
  • add "-tc" option.
  • on http url media or local video file.

All failed.
It seems DLNA doesn't support subtitle.

Can't connect to AVTransport

Hello,

Thanks for building this tool.
I can't connect to my DLNA speakers as I am getting the following error:

SendtoTV set AVT Transport error: setAVTransportSoapCall Do POST error: Post "http://192.168.1.32:54380/upnp/control/AVTransport": POST http://192.168.1.32:54380/upnp/control/AVTransport giving up after 4 attempt(s)

I'm running the tool on Ubuntu 20, and the speakers are working well with other DLNA renderer (like the default one in Windows).

Let me know if you need more information.

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.