Friday, August 10, 2007

HOWTO cut a clip from an avi

Suppose you have a large video, or movie and you want to send your friend just a clip from it. Well you will need to cut that clip out of the movie. First, find out at which time time starts the clip you wish to cut. Next, find out how long does it last.
For example, the clip starts at 00:51:42 (hours:minutes:seconds) and ends at 00:55:12. So the duration of the clip is 00:03:30.

Now open terminal and type:

sudo apt-get install ffdshow

This will install the necessary software. Navigate to the folder where your movie/clip is located and type:

ffdshow -i movie.avi -ss 00:51:42 -t 00:03:30 clip.avi

This will get you the desired clip. Now let me explain you the commands in short:

-i movie.avi - this is the input file
-ss hh:mm:ss - this is the time at which the extracted clip starts
-t hh:mm:ss - this is the duration of the clip
clip.avi - this is the output file

In case the clip size is still to large you can also use ffdshow to reduce its size.
Click here to see how.

Friday, August 3, 2007

HOWTO moutn bin/cue, iso, mds, ccd and nrg files (Feisty)

Before we start I'd like to be sure you know how to mount regular ISO files. Use terminal to navigate to the folder containing your ISO image and type:

sudo mkdir /media/virtual
sudo modprobe loop
sudo mount image.iso /media/virtual -o loop
Now let's proceed.

I'm sure you have many times downloaded a CD/DVD image that wasn't standard iso file. The problem with these ones is that you cannot mount them in Ubuntu. There are many bin2iso and similar converter programs but theres a simple way to get these images mounted. It's called cdemu.

Before you continue be aware. If you have download bin/cue image that should contain a video it is possible that it's a svcd image and if this is the case mplayer can natively read this files. Just type

mplayer image.bin

and it should work.

Also, with VLC player you can play iso files. To install vlc type:

sudo apt-get install vlc

If this is not the case download latest cdemu from here. Extract it and navigate to the extracted folder. Feisty users should type:

nano cdemu_core.c

and replace the generic_file_read with do_sync_read. It should be done in two lines as shown on images below.




Now type:

make
sudo make install
sudo gedit /usr/bin/create_cdemu_devs.sh

and replace everything with following:

#!/bin/bash

#if [ -e /dev/.devfs ] ; then
# echo "You have devfs, nodes will be created automagically"
# exit 0
#fi
#if [ -e /dev/.udev ] || [ -e /dev/.udev.tdb ] ; then
# echo "You have udev, nodes will be created automagically"
# exit 0
#fi
#if [ ! -z "${DESTDIR}" ] ; then
# echo "Creating a package, nodes should be created later"
# exit 0
#fi

# find out cdemu device major number
if [ ! -r /proc/devices ]; then
echo "Can't open /proc/devices, make sure /proc is mounted"
exit 0
fi

modprobe cdemu
if [ -z "$(lsmod | grep ^cdemu)" ]; then
echo "Can't load module"
exit 0
fi
cdemumajor=$(grep "^[[:space:]]*[0-9]\+[[:space:]]\+cdemu$" /proc/devices | grep -o "[0-9]\+")
if [ -z "$cdemumajor" ]; then
echo "Can't find cdemu device number in /proc/devices"
exit 0
fi
#modprobe -r cdemu
#

if [ -e /dev/cdemu ]; then
rm -rf /dev/cdemu
fi
if [ -b /dev/cdemu0 ]; then
rm -f /dev/cdemu*
fi
mkdir /dev/cdemu
for drivenumber in `seq -w 0 7` ; do
mknod /dev/cdemu/${drivenumber} b ${cdemumajor} ${drivenumber}
done

#echo "if no error did show up device files created ;-)"

Next type:

sudo nano /etc/rc.local

and before exit 0 you add following:
echo " Creating CDemu devices..."
create_cdemu_devs.sh

Type:

sudo modprobe loop
sudo create_cdemu_devs.sh

And thats it. To mount bin/cue image type:

cdemu X image.cue
mkdir /media/cdemuX
sudo mount -t iso9660 -o -ro /dec/cdemu/X /media/cdemuX

Where X is any integral number between 0 and 7 (X=0,1,2,3,...,7). This is because u get 8 virtual CD-ROMs so you can mount 8 images at the same time.

To unmount image type:

cdemu -u X

where X is the number of drive you wish to unmount.

You can find more tips on configuring your cdemu here. Steps 7. and successive.