Posts Tagged ‘Mac Os X’

Extract mp3 audio from streaming videos

Sometimes you may just want to get the soundtrack of a video. And you know, today most videos are available in streaming on the web. There are several ways to download those videos, depending on the service that hosts them, but there are also many websites that explains how to do that. To give an example, youtube player retrieve videos requesting an URL with parameters that include the ID of the video and a signature it got when it’s loaded. To emulate this behaviour and get yourself the video to download, you can eg. use one of the appropriate firefox plugins , rather than getting the url from one of the many websites that build it for you. Anyway, streaming videos are in .flv or .mp4 formats. If you want to get the audio from an .flv video, you just need ffmpeg, running

ffmpeg -i "video.flv" -f mp3 -vn -acodec copy "audio.mp3"

If you want to get the .mp3 audio from an .mp4 video instead, you may use faad2 and lame to just decode the .mp4 audio to .wav e reencode it to an .mp3 .

faad -o - "video.mp4" | lame - "audio.mp3"

You can get both faad2 and lame as well as ffmpeg via apt or whatever package manager you use in Linux, and via MacPorts of Fink in Mac Os X.


How to use the "vi" Text Editor

I have been recently asked to deliver a lesson in the base linux course LUG Roma3, which I cooperate with, is keeping at roma3 university on voluntary base.
Here are the slide I sketched out for this occasion.



I delivered a similar lesson on last edition of this course and also wrote a paper from what I presented at that time, but I think this pack is definitely better, and less boring than a long paper, so i’m removing the old post in behalf of this new one =)


OSX – Serial Connections, These strangers

serial-connector When you have to locally manage scrap metals, it doesn’t matter if you are connecting a  microwave oven or a dozen of thousands bucks value brand new router or firewall, you will  probably do that over a serial cable. Devices likely offers a port labeled CONSOLE or  whatever you should connect the cable to. The cable type is device-dependent, but it usually  ends up with a serial connector for a serial port. If your computer doesn’t have that port, you  will need an adapter and its driver, such as to an USB port. While in linux you just modprobe the usbserial module with the appropriate vendor and product code, such as:

modprobe usbserial vendor=0xVID product=0xPID

for osx you may need the adapter drivers from the vendor ( they should be available on the vendor’s site, otherwise change vendor =P ). However, when the cable is plugged, you should find the proper entry for the (adapter) device, named tty.<whatever>

ls -1 /dev/tty.*

Now you will need to attach a terminal emulator to the found serial port to access the connected device console. On Mac Os X, as linux users will like, minicom is one of the best choices. Install it via MacPorts or Fink, then use:

minicom -s

to edit the default /opt/local/etc/minirc.dfl config file or to generate configurations that will be saved to /opt/local/etc/minirc.<your-config-name>. You should at least specify the port, baudrate, data bits, parity, stop bits and flow control. These are often indicated in the machine specs, with strings like the common 9600/8N1.


Tree

Tree Some times you want to recursively check the contents of a given directory right in your shell  asking for its inherent tree.

But sometimes the ‘tree’ utility is not available, and you may have no rights to install it or you  just  don’t want to. Other times you may even have to deal with ports to  get  the simple tree  utility.

In these cases, find and sed are here to help:

#!/bin/bash
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

Return top

About me