You are not logged in.
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" | smplayer
This starts smplayer and downloading of a video. But when the video is downloaded, smplayer doesn't play it. Same with gnome-mplayer. What am I doing wrong?
Last edited by Mr. Alex (2011-06-13 09:06:25)
Offline
Always check the man pages. You never know what you will find !!
clive --player="/path/to/player %i" --play URL
Play video after extraction. Unlike with --encoder, only
%i (input file) is required.e.g.:
clive -p player="vlc --fullscreen %i" URL
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
My "man clive" doesn't have this information at all. My clive also doesn't have "-p" option.
And even if it had - why doesn't my method work? It should, right?
Offline
your method doesn't work probably because the video player does not take a piped input.
mplayer can play files from urls as well. you might just want to use that instead of clive.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
I neither have the --player option but
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" | smplayer
shouldn't work because, one the one hand clive doesn't send the raw video data to stdout, and one the other hand, smplayer doesn't read from stdin. I'm not entirely sure if I'm understanding what you are trying to archive. Either you are trying to download a video, and if it has finished, automatically start it with a video player. That would be done with &&:
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" && mplayer *.flv
Or you are trying to download a video, and start playing it at the same time, involving clive and a video player. In such a scenario i usually use two terminals, one for downloading, and one for playing the unfinished file. However, if you want it to happen in the same terminal, it would be something similar to this:
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" & until [ ]; do mplayer *.flv ; done
Which would basically fork clive to the background and then enter an infinite loop of calling your player. In case you have a very fast internet connection, and your video playback is always slower than your download speed, the loop isn't needed. Though, there are probably more elegant solutions. Have a look at this: https://bbs.archlinux.org/viewtopic.php … 07#p862507
Edit:
Also, doing the loop with mplayer seems more cleaner:
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" & mplayer -loop 0 *.flv
Last edited by Wey (2011-06-12 18:08:24)
Offline
Thanks, Wey. Loop works but that's not quite what I need. I want to download a video with best quality and open it after it's completely downloaded because I have slow CPU and can't watch 720p in flash, but can watch even 1080p in player like gnome-mplayer (my Internet-traffic speed is also not enough for loop you suggested if I download best quality like 1080p). After I watched a video I don't need the file any more. This will allow me to watch YouTube files in the best quality with more stability in process (slow CPU and buggy flash in classical way).
So I figured, this looks like:
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" -f best -O file && gnome-mplayer file
Is it possible to create a script which will take a URL as a variable and insert it to the command
clive "http://www.youtube.com/watch?v=OI3gKGhe0QM" -f best -O file && gnome-mplayer file
like:
$ watch-vid.sh http://www.youtube.com/watch?v=OI3gKGhe0QM
$URL = http://www.youtube.com/watch?v=OI3gKGhe0QM
clive "$URL" -f best -O file && gnome-mplayer file
?
Last edited by Mr. Alex (2011-06-12 19:41:25)
Offline
In a bash script $1 represents the first argument. So watch-video.sh could look like this:
#!/bin/bash
NAME=$HOME/`echo "$1" | md5sum | cut -d ' ' -f1`
clive $1 -f best -O $NAME
mplayer $NAME
rm $NAME
It temporarily saves the video in your home dir, named as the hash of the url.
Invoke it with
sh ./watch-video.sh http://www.youtube.com/watch?v=OI3gKGhe0QM
Or do chmod +x on it and put in your path.
Edit: Removed the dash in front of "best" as Mr. Alex pointed out.
Last edited by Wey (2011-06-13 10:25:10)
Offline
Thanks! It works just like I need.
The only command to fix is:
clive $1 -f -best -O $NAME
which shouldn't contain dash before "best".
Last edited by Mr. Alex (2011-06-13 09:08:10)
Offline