Since this blog was intended for writing out tutorials anyway. Why not start with this rather old one?
For a post about converting from one filetype to another, in this case video, go here.
By default Ubuntu uses the /home/yourUserName/bin or $HOME/bin for short as the default folder where users can store and execute their handy little scripts. 😉
Please note! That (after finding out the hard way 😉 ) simply putting ‘executable’ files into the ‘bin’ directory doesn’t work? Because I get a command not found reply!!?
To overcome this little obstacle:
Open up your .bashrc * file – i.e. press ALT+F2 then type gedit .bashrc in the box At the bottom of the file paste in the two lines below.
* = . (dot) files are usually hidden
PATH=$PATH:$HOME/bin export PATH
Now it will work! I still don’t know why the default doesn’t work though? An excerpt from the .profile file (lines 19 to 22) shows that it should!
# set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
Some days ago a YouTube user asked me if I had a particular song for him in mp3 format. Unfortunately I couldn’t help out. 😦 But what I did tell was the following:
If you’re on a Debian alike system like say Ubuntu? You can always ‘download’ (and rename!) the flash file you just watched. 😉 Now there are two ways (at least) to do this. One is the ‘hard’ way which involves typing every command again, again and again.
* While watching, or more preferably after watching (or if the statusbar of the video is full!) a video you like!
mv /tmp/Flash* $HOME/some/path/ cd $HOME/some/path mv Flash* WhatEverYouLike.flv
After 5 or more videos you will start to get bored by this act of repetition. 😆
* The other way is to create a script!
To do so, open up a terminal:
Applications ->Accessories ->Terminal
Copy & Paste this following line. It will create (after typing _EOF_ on a new line, see below) a file called ‘get-flash’ into a directory named ~/bin (see above).
cat << _EOF_ >> $HOME/bin/get-flash
Now copy & paste (or type?) the following lines after the first > sign.
#!/bin/bash echo -n "Enter filename: " # As it says. read file_name file_name=$file_name.flv # Appends the extension .flv onto the filename. # $HOME is a shortcut for /home/yourUserName # It is highly unlikely that one has to create a 'Videos' directory\! # Since it is one of Ubuntu's default folders, # but just in case yours does not exist\? Uncomment the line below. # [ ! -d "$HOME/Videos" ] && mkdir $HOME/Videos # If the directory 'Flash' doens't exist\? Create one now. [ ! -d "$HOME/Videos/Flash" ] && mkdir $HOME/Videos/Flash # This moves the recently watched flash movie into the directory you created. # Just make sure that you haven't moved on to the next clip # you wanted to watch. I.e. it is a one download per page-load. mv /tmp/Flash* $HOME/Videos/Flash/ cd $HOME/Videos/Flash/ # Go to Flash directory mv Flash* $file_name # Rename file into specified name. # This will return the terminal prompt as you left it, # while you were executing this script. cd $HOME # Go back home exit 0
After typing and or pasting you should be on a newline now (preceded by an > sign!) Now type _EOF_ and your new file should be written out. You can test this by doing the following:
ls -lh $HOME/bin/get-flash
Make it executable!
chmod u+x $HOME/bin/get-flash # u means user.
Now go rush over to Youtube and ‘download’ away! 😀 The extraction of sound and/or video of individual flash files is beyond the scope of this little tutorial. Try google: How to extract sound and video from flash files while using Ubuntu, or something like that.
Perhaps something like this might work!?
## First do: sudo apt-get install vorbis-tools ## Because 'oggenc' is provided by this package. ## Then: cd $HOME/Videos/Flash/ for i in *.flv; do ffmpeg -i "$i" -f wav $(basename "$i" .flv).wav;done for i in *.wav; do oggenc -q 5 "$i";done ## This makes my samsung S3 audio player happy.
I hope this helps.
PS: Dude this trick is as old as the way to Rome is. Perhaps? For some people old roads are always new when looked at for a first time.