Difference between revisions of "Small Video Processing Guide"

From IridiaWiki
Jump to navigationJump to search
 
 
(8 intermediate revisions by the same user not shown)
Line 12: Line 12:
 
For video capture and mpeg encoding, I installed the following packages (debian packages of similar name should be available). I would suggest to install mplayer and transcode first, and then you have a look to what could be missing.
 
For video capture and mpeg encoding, I installed the following packages (debian packages of similar name should be available). I would suggest to install mplayer and transcode first, and then you have a look to what could be missing.
   
dvgrab-2.0-1.pm
+
dvgrab-2.0-1.pm<br>
libiec61883-1.0.0-1
+
libiec61883-1.0.0-1<br>
lame-3.96.1
+
lame-3.96.1<br>
mplayerplug-in-2.80-0
+
mplayerplug-in-2.80-0<br>
MPlayer-1.0pre7
+
MPlayer-1.0pre7<br>
w32codec-all-20050412-0
+
w32codec-all-20050412-0<br>
a52dec-0.7.4-3
+
a52dec-0.7.4-3<br>
libffmpeg0-0.4.9-3
+
libffmpeg0-0.4.9-3<br>
faad2-2.0-0
+
faad2-2.0-0<br>
lve-0.040322-0.
+
lve-0.040322-0<br>
ffmpeg-0.4.9-3
+
ffmpeg-0.4.9-3<br>
mjpegtools-1.7.0-0
+
mjpegtools-1.7.0-0<br>
libfame-0.9.1-0
+
libfame-0.9.1-0<br>
transcode-0.6.14-0
+
transcode-0.6.14-0<br>
libraw1394-1.1.0-3
+
libraw1394-1.1.0-3<br>
 
   
 
== Part B) How to retrieve movies from a digital camcorder. ==
 
== Part B) How to retrieve movies from a digital camcorder. ==
Line 46: Line 45:
 
Remarks: There can be problems, if
 
Remarks: There can be problems, if
   
a) your filesystem (e.g. FAT32) does not allow for files bigger than 2GB,
+
a) your filesystem (e.g. FAT32) does not allow for files bigger than 2GB,<br>
b) your kernel does not recognize the camera (capture does not start),
+
b) your kernel does not recognize the camera (capture does not start),<br>
c) if your harddisk is running out of space (1 hour tape is 13 GB approx.),
+
c) if your harddisk is running out of space (1 hour tape is 13 GB approx.),<br>
d) if your harddisk is slow (e.g. some external USB) it cannot handle the constant flow of data coming from the camera.
+
d) if your harddisk is slow (e.g. some external USB) it cannot handle the constant flow of data coming from the camera.<br>
   
 
Normally, each scene goes in a separate file. However, sometimes, a scene is split by mistake into multiple files. These files you can merge with
 
Normally, each scene goes in a separate file. However, sometimes, a scene is split by mistake into multiple files. These files you can merge with
Line 58: Line 57:
   
 
man avisplit
 
man avisplit
 
   
 
== Part C) How to make small MPEG4 movies for your webpage including author and institution frames. ==
 
== Part C) How to make small MPEG4 movies for your webpage including author and institution frames. ==
Line 76: Line 74:
 
It is necessary to specify all 3 digits (from 001 to 999).
 
It is necessary to specify all 3 digits (from 001 to 999).
   
 
#!/bin/bash
<nowiki>
 
  +
name=$1
#!/bin/bash
 
name=$1
+
time=$2
 
for I in `seq 1 ${time}`
time=$2
 
 
do
for I in `seq 1 ${time}`
 
 
if [ $I -lt 10 ]; then
do
 
if [ $I -lt 10 ]; then
 
 
cp ${name}.ppm ${name}00$I.ppm
 
cp ${name}.ppm ${name}00$I.ppm
else
+
else
 
if [ $I -lt 100 ]; then
 
if [ $I -lt 100 ]; then
 
cp ${name}.ppm ${name}0$I.ppm
 
cp ${name}.ppm ${name}0$I.ppm
Line 90: Line 87:
 
cp ${name}.ppm ${name}$I.ppm
 
cp ${name}.ppm ${name}$I.ppm
 
fi
 
fi
fi
+
fi
done
+
done
   
 
cp paramfile.txt p.txt
 
cp paramfile.txt p.txt
Line 99: Line 96:
 
rm ${name}???.ppm
 
rm ${name}???.ppm
 
rm p.txt
 
rm p.txt
  +
#transcode -i ${name}.mpeg -y ffmpeg -F dvvideo -Z 720x576 --encode_fields b -o ${name}.avi
 
transcode -i ${name}.mpeg -y ffmpeg -F mpeg4 -Z 480x384 --encode_fields b -o ${name}.avi
+
transcode -i ${name}.mpeg -y ffmpeg -F mpeg4 -Z 480x384 --encode_fields b -o
  +
${name}.avi
</nowiki>
 
   
 
You need to create the file paramfile.txt, name and timing are adjusted automatically by the script above:
 
You need to create the file paramfile.txt, name and timing are adjusted automatically by the script above:
   
 
PATTERN I
<nowiki>
 
 
PIXEL HALF
PATTERN I
 
 
IQSCALE 10
 
PQSCALE 10
 
BQSCALE 10
 
RANGE 10
 
PSEARCH_ALG LOGARITHMIC
 
BSEARCH_ALG SIMPLE
 
OUTPUT NNAAMMEE.mpeg
 
GOP_SIZE 5
 
SLICES_PER_FRAME 1
 
BASE_FILE_FORMAT PPM
 
INPUT_CONVERT *
 
INPUT_DIR .
 
INPUT
 
NNAAMMEE*.ppm [001-FFRRAAMMEESS+1]
 
END_INPUT
 
FRAME_RATE 25
 
REFERENCE_FRAME DECODED
   
PIXEL HALF
 
 
IQSCALE 10
 
 
PQSCALE 10
 
 
BQSCALE 10
 
 
RANGE 10
 
 
PSEARCH_ALG LOGARITHMIC
 
BSEARCH_ALG SIMPLE
 
 
OUTPUT NNAAMMEE.mpeg
 
 
GOP_SIZE 5
 
 
SLICES_PER_FRAME 1
 
 
BASE_FILE_FORMAT PPM
 
 
INPUT_CONVERT *
 
 
INPUT_DIR .
 
 
INPUT
 
NNAAMMEE*.ppm [001-FFRRAAMMEESS+1]
 
END_INPUT
 
 
FRAME_RATE 25
 
 
REFERENCE_FRAME DECODED
 
</nowiki>
 
   
 
2. Once you have the author and institution sub-movies, you just have to execute the following script for encoding the movies for your webpage:
 
2. Once you have the author and institution sub-movies, you just have to execute the following script for encoding the movies for your webpage:
Line 157: Line 138:
 
Remarks:
 
Remarks:
   
a) You need all avi's in the same directory. The once from the tape start with tape, the others are called author.avi and end.avi
+
a) You need all avi's in the same directory. The once from the tape start with tape, the others are called author.avi and end.avi<br>
b) The size of these movies is only 480x384. This safes for sure space, and might even improve quality. MPEG4 will be standard in some future. It is based on DIVX as far as I understood. You can play the movies with mplayer, mplayer-plugin for mozilla.
+
b) The size of these movies is only 480x384. This safes for sure space, and might even improve quality. MPEG4 will be standard in some future. It is based on DIVX as far as I understood. You can play the movies with mplayer, mplayer-plugin for mozilla.<br>

Latest revision as of 21:10, 1 June 2005

This is a Linux based solution. It has been tested under SuSE 9.3, and it should work under Debian as well if the system is properly configured.


Part A) Requirements

1. Firewire interface

2. Disk space (around 13GB per hour of tape)

3. Software

For video capture and mpeg encoding, I installed the following packages (debian packages of similar name should be available). I would suggest to install mplayer and transcode first, and then you have a look to what could be missing.

dvgrab-2.0-1.pm
libiec61883-1.0.0-1
lame-3.96.1
mplayerplug-in-2.80-0
MPlayer-1.0pre7
w32codec-all-20050412-0
a52dec-0.7.4-3
libffmpeg0-0.4.9-3
faad2-2.0-0
lve-0.040322-0
ffmpeg-0.4.9-3
mjpegtools-1.7.0-0
libfame-0.9.1-0
transcode-0.6.14-0
libraw1394-1.1.0-3

Part B) How to retrieve movies from a digital camcorder.

1. Attach the camcorder with the firewire cable to your computer.

2. Turn in on, and insert a tape.

3. Become super user.

4. Execute (assuming it is tape 1 of your collection):

dvgrab --autosplit --format dv2 --opendml --size 0 --buffers 512 tape1-

5. The camera starts automatically, once the tape is finished stop the process.

Remarks: There can be problems, if

a) your filesystem (e.g. FAT32) does not allow for files bigger than 2GB,
b) your kernel does not recognize the camera (capture does not start),
c) if your harddisk is running out of space (1 hour tape is 13 GB approx.),
d) if your harddisk is slow (e.g. some external USB) it cannot handle the constant flow of data coming from the camera.

Normally, each scene goes in a separate file. However, sometimes, a scene is split by mistake into multiple files. These files you can merge with

avimerge -i file1 file2 file2 ... -o together.avi

Sometimes it can happen also that several scenes go into a single file. For this check

man avisplit

Part C) How to make small MPEG4 movies for your webpage including author and institution frames.

1. Prepare author and institution frames (if applicable, ask Marco).

a) For swarm-bots, we have Photoshop templates (ask Roderich or Christos for the file if it was already created for you). Convert them with Gimp to the ppm format and name them author.ppm and end.ppm. The author frame comes right after the movie, the instituiton frame appears in the end.

b) If you have a single ppm file, you can make a movie out of it using the following script ppm2avi.sh. For this, ppmtompeg has to be installed.

Example: To have the author frame shown for 75 frames (i.e., 3 seconds; 25 frames per second) execute:

sh ppm2avi.sh author 075

It is necessary to specify all 3 digits (from 001 to 999).

 #!/bin/bash
 name=$1
 time=$2
 for I in `seq 1 ${time}`
 do
  if [ $I -lt 10 ]; then
    cp ${name}.ppm ${name}00$I.ppm
  else
    if [ $I -lt 100 ]; then
        cp ${name}.ppm ${name}0$I.ppm
    else
        cp ${name}.ppm ${name}$I.ppm
    fi
  fi
 done

cp paramfile.txt p.txt perl -pi -e "s/NNAAMMEE/${name}/g;" p.txt perl -pi -e "s/FFRRAAMMEESS/${time}/g;" p.txt ppmtompeg p.txt rm ${name}???.ppm rm p.txt

transcode -i ${name}.mpeg -y ffmpeg -F mpeg4 -Z 480x384 --encode_fields b -o ${name}.avi

You need to create the file paramfile.txt, name and timing are adjusted automatically by the script above:

PATTERN I
PIXEL HALF
IQSCALE 10
PQSCALE 10
BQSCALE 10
RANGE 10
PSEARCH_ALG LOGARITHMIC
BSEARCH_ALG SIMPLE
OUTPUT NNAAMMEE.mpeg
GOP_SIZE 5
SLICES_PER_FRAME  1
BASE_FILE_FORMAT PPM
INPUT_CONVERT *
INPUT_DIR .
INPUT
NNAAMMEE*.ppm [001-FFRRAAMMEESS+1]
END_INPUT
FRAME_RATE 25
REFERENCE_FRAME DECODED


2. Once you have the author and institution sub-movies, you just have to execute the following script for encoding the movies for your webpage:

#!/bin/bash for I in tape*.avi do basename=`echo $I | cut -d\. -f1` echo ${basename}.avi transcode -i ${basename}.avi -w 500 -x ffmpeg,avi -y ffmpeg -F mpeg4 -Z 480x384 --encode_fields b -o ${basename}_plain.mpeg --print_status 100 avimerge -i ${basename}_plain.mpeg author.avi end.avi -o ${basename}.mpeg done

Remarks:

a) You need all avi's in the same directory. The once from the tape start with tape, the others are called author.avi and end.avi
b) The size of these movies is only 480x384. This safes for sure space, and might even improve quality. MPEG4 will be standard in some future. It is based on DIVX as far as I understood. You can play the movies with mplayer, mplayer-plugin for mozilla.