You are not logged in.

#1 2014-03-16 23:24:46

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

[SOLVED] streaming videos directly to mplayer?

basically what i want to do is watching online videos from the shell via mplayer and elinks w/o downloading them, but not to be limited to youtube, so youtube-viewer is not an option. problem is that mplayer doesn't seem to do the job. some claim you only have to pass an url as an arg for it and that's it.

$ mplayer -prefer-ipv4 [url]http://www.youtube.com/watch?v=QCuq0_nY3Xk[/url]

MPlayer SVN-r36498-snapshot-4.8.2 (C) 2000-2013 MPlayer Team
206 audio & 433 video codecs
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://www.youtube.com/watch?v=QCuq0_nY3Xk.
Resolving www.youtube.com for AF_INET...
Connecting to server www.youtube.com[173.194.39.137]: 80...

Cache size set to 320 KBytes
Cache fill:  2.35% (7716 bytes)   

libavformat version 55.19.104 (internal)


Exiting... (End of file)

but that's not it, alas. i passed in different cache sizes as well, but that didn't help either. the funny thing is that youtube-viewer uses mplayer as well and worked perfectly out of the box. i looked at the script and mostly additional args are there as extras.

    cache             => 30000,
    cache_min         => 5,
    lower_cache       => 2000,
    lower_cache_min   => 3,
    mplayer           => get_mplayer(),
    mplayer_srt_args  => '-sub %s',
    mplayer_arguments => '-prefer-ipv4 -really-quiet -cache %d -cache-min %d',
# Get mplayer
sub get_mplayer {
    if ($constant{win32}) {
        my $smplayer = catfile($ENV{ProgramFiles}, qw(SMPlayer mplayer mplayer.exe));

        if (not -e $smplayer) {
            warn "\n\n!!! Please install SMPlayer in order to stream YouTube videos.\n\n";
        }

        return $smplayer;    # Windows MPlayer
    }
    else {
        my $mplayer_path = '/usr/bin/mplayer';
        return -x $mplayer_path ? $mplayer_path : q{mplayer}    # *NIX MPlayer
    }
}

anyone had this issue before? i really could use some ideas. thanks in advance

Last edited by wootsgoinon (2014-03-17 01:07:10)

Offline

#2 2014-03-16 23:28:16

progandy
Member
Registered: 2012-05-17
Posts: 5,268

Re: [SOLVED] streaming videos directly to mplayer?

youtube doesn't give up its video url easily. You could try it with youtube-dl:

mplayer "$(youtube-dl -g http://www.youtube.com/watch?v=QCuq0_nY3Xk)"

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2014-03-16 23:33:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] streaming videos directly to mplayer?

Try mpv instead of mplayer.

mpv <url>

Offline

#4 2014-03-16 23:42:13

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

Re: [SOLVED] streaming videos directly to mplayer?

mpv is great for X, but it won't work on the framebuffer (not for me at least).

mplayer -vo help

Available video output drivers:
	vdpau	VDPAU with X11
	xv	X11/Xv
	gl_nosw	OpenGL no software rendering
	x11	X11 ( XImage/Shm )
	xover	General X11 driver for overlay capable video output drivers
	sdl	SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)
	gl	OpenGL
	gl_tiled	X11 (OpenGL) - multiple textures version
	dga	DGA ( Direct Graphic Access V2.0 )
	fbdev	Framebuffer Device
	fbdev2	Framebuffer Device
	matrixview	MatrixView (OpenGL)
	aa	AAlib
	caca	libcaca
	v4l2	V4L2 MPEG Video Decoder Output
	xvidix	X11 (VIDIX)
	cvidix	console VIDIX
	null	Null video output
	xvmc	XVideo Motion Compensation
	mpegpes	MPEG-PES to DVB card
	yuv4mpeg	yuv4mpeg output for mjpegtools
	png	PNG file
	jpeg	JPEG file
	gif89a	animated GIF output
	tga	Targa output
	pnm	PPM/PGM/PGMYUV file
	md5sum	md5sum of each frame
	mng	MNG file
mpv -vo help

Available video outputs:
  vdpau          : VDPAU with X11
  opengl         : Extended OpenGL Renderer
  xv             : X11/Xv
  opengl-old     : OpenGL (legacy VO, may work better on older GPUs)
  vaapi          : VA API with X11
  x11            : X11 ( XImage/Shm )
  null           : Null video output
  image          : Write video frames to image files
  opengl-hq      : Extended OpenGL Renderer (high quality rendering preset)
  wayland        : Wayland SHM video output

Offline

#5 2014-03-16 23:43:45

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] streaming videos directly to mplayer?

Why you want to use just the framebuffer for watching videos?

Offline

#6 2014-03-16 23:49:58

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

Re: [SOLVED] streaming videos directly to mplayer?

karol wrote:

Why you want to use just the framebuffer for watching videos?

because i'd like to watch videos without X.

Offline

#7 2014-03-16 23:50:31

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] streaming videos directly to mplayer?

Offline

#8 2014-03-16 23:53:23

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

Re: [SOLVED] streaming videos directly to mplayer?

progandy wrote:

youtube doesn't give up its video url easily. You could try it with youtube-dl:

mplayer "$(youtube-dl -g http://www.youtube.com/watch?v=QCuq0_nY3Xk)"

yes i tried that too. it downloaded, then when i got mplayer on it it gave me

"no stream found to handle url"

Offline

#9 2014-03-16 23:56:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] streaming videos directly to mplayer?

If youtube-dl is not enough, try e.g. quvi.

Offline

#10 2014-03-17 00:17:58

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

Re: [SOLVED] streaming videos directly to mplayer?

karol wrote:

If youtube-dl is not enough, try e.g. quvi.

i just tried it. there's no display on the tty. it's quite nice to know about this, though, thank you.

Offline

#11 2014-03-17 00:23:03

progandy
Member
Registered: 2012-05-17
Posts: 5,268

Re: [SOLVED] streaming videos directly to mplayer?

youtube-dl accesses youtube with https. and mplayer doesn't support https urls. You could use quvi instead or try curl:

curl --ciphers RC4-SHA "$(youtube-dl -g ...)" | mplayer - 
quvi dump -p rfc2483 http://www.youtube.com/watch?v=QCuq0_nY3Xk | {read comment && read url}
mplayer "$url"

Edit: I guess this will be the best:

mplayer -playlist <(quvi dump -p rfc2483 http://www.youtube.com/watch?v=QCuq0_nY3Xk)
; or maybe mplayer -playlist /proc/self/fd/4 4< <(quvi dump -p rfc2483 "$url")

Last edited by progandy (2014-03-17 00:50:28)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#12 2014-03-17 00:58:08

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] streaming videos directly to mplayer?

You can even try running vlc in the framebuffer.

Offline

#13 2014-03-17 00:59:16

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

Re: [SOLVED] streaming videos directly to mplayer?

progandy wrote:

youtube-dl accesses youtube with https. and mplayer doesn't support https urls. You could use quvi instead or try curl:

curl --ciphers RC4-SHA "$(youtube-dl -g ...)" | mplayer - 
quvi dump -p rfc2483 http://www.youtube.com/watch?v=QCuq0_nY3Xk | {read comment && read url}
mplayer "$url"

Edit: I guess this will be the best:

mplayer -playlist <(quvi dump -p rfc2483 http://www.youtube.com/watch?v=QCuq0_nY3Xk)
; or maybe mplayer -playlist /proc/self/fd/4 4< <(quvi dump -p rfc2483 "$url")

this is great, thank you!

Offline

#14 2014-03-17 00:59:53

wootsgoinon
Member
Registered: 2013-10-30
Posts: 44

Re: [SOLVED] streaming videos directly to mplayer?

karol wrote:

You can even try running vlc in the framebuffer.

i will link into that too, thanks!

Offline

#15 2015-01-10 09:11:20

chilicuil
Member
Registered: 2014-03-22
Posts: 7
Website

Re: [SOLVED] streaming videos directly to mplayer?

progandy wrote:

youtube-dl accesses youtube with https. and mplayer doesn't support https urls. You could use quvi instead or try curl:

curl --ciphers RC4-SHA "$(youtube-dl -g ...)" | mplayer - 

You don't need curl/wget if already using youtube-dl, I stream videos to mplayer this way:

youtube-dl -q -o- $url | mplayer -cache 8192  -

Offline

#16 2016-12-07 02:19:50

Chuck Arch Linux
Member
Registered: 2011-06-23
Posts: 81

Re: [SOLVED] streaming videos directly to mplayer?

Hi everyone,
                  I'm using this command to stream youtube video to mplayer in framebuffer where "$video" is the video link:

youtube-dl -o - -f '(best[height<=1080])[protocol^=https]' $video | mplayer -vo fbdev2 -zoom -xy 1920 -cache 30720 -cache-min 2 -

Video is playing but I don't have any keyboard control at all, only "ctlr+c" work
Playing the video without the pipe work normaly
Using this piped command in X with same video work with keyboard control

Anyone know how to keep mplayer ontop to maintain keyboard control?

***Update***
Ok for those interested, trying redirection of stdin to keep control work,

youtube-dl -o - -f '(best[height<=1080])[protocol^=https]' $video | mplayer -vo fbdev2 -zoom -xy 1920 -really-quiet -cache 30720 -cache-min 2 /dev/fd/3 3<&0 </dev/tty

Any other thought?

Last edited by Chuck Arch Linux (2016-12-07 03:35:09)

Offline

Board footer

Powered by FluxBB