tibit.org – Linux Video Hacks

"Video-encoding-junkie? Me? Let me think about it for 25 frames, ehh, one second"

Transcode mailing list archive

I have put up a searchable mailing list archive of transcode-devel and transcode-users and some other mailing lists at http://www.itdp.de. Enjoy!

Profiling transcode

I profiled transcode-0.6.0rc2, here are the results for reference. Profiling transcode is a bit tricky because transcode is a multithreaded application and uses a lot of shared libraries. The functions from the various import and export modules don't show up in the profile. To profile the threads, I used the idea from HOWTO: using gprof with multithreaded applications
If you don't have the slightest idea howto read the profiles, you may mant to look at the gprof manual at http://www.gnu.org/manual/gprof-2.9.1/html_mono/gprof.html#SEC11

gprof-orig-rc2.txt: transcode -v -i matrixbench_mpeg2.mpg -x mpeg2
gprof-j.txt: transcode -v -i matrixbench_mpeg2.mpg -x mpeg2 -j 128,8
gprof-b-j.txt: transcode -v -i matrixbench_mpeg2.mpg -x mpeg2 -b 1,2 -j 128,8
gprof-b-j-xvid.txt: transcode -v -i matrixbench_mpeg2.mpg -x mpeg2 -b 1,2 -j 128,8 -y xvidcvs -o foo.avi -w 800

NVrec - transcode info

(Jun 26 2002) NVrec moved to http://nvrec.sf.net and got renamed to nvrec. Transcode >= 0.6.0rc2 can deal with it.

(May 23 2002) If you came here looking for the nvrec-RAWrec patch this is for you. As I wrote on transcode-users in this message:

I removed the patch because there is now an official release of
NVrec at http://nvrec.sf.net
which contains support for transcode.

RAWrec has become 'DIVX4rec -o raw://' which has become 'divx4rec -o raw://'
and you have to use transcode-0.6.0-pre5. See /docs/import_nvrec.txt in transcodes
directory for Changelog and usage.
Be sure to disable transcodes autoprobing and YUV mode, an working example command line would be

$ transcode -i /dev/video0 -x nvrec -y xvidcvs,null \ -g 576x432 -V -e 44100,16,2 -J ppcvs="lb tn:64:128:256 dr" \ -H0 -u 100 -o video-foo.avi -m audio-foo.avi

transcode deinterlacer test

I've done some testing of deinterlacers available in transcode

The result was produced with this shell script. Note that you'll need "convert" from the ImageMagick package. The script isn't assumed to be usuable to the public, it is mainly provided here for reference and You are encouraged to read it. The input was a raw captured Y'CbCr stream from my video capture card.

This is a jpg version of the resulting images. For accuracy please download the bzip'd ppm version.
low-res jpg result

Deinterlacing is always a compromise between speed and quality. So if you have lots of cpu cycles to spend, I would use either "-I3" or the "smartdeinter" filter plugin I ported over from VirtualDub.

zoomto transcode Script

This script generates -B or -X options for transcode
you can download the script here

If (for example) you want to transcode a 640x480 video to 384x288 but don't want to use the slow (but high quality) -Z zoom option and you are too lazy to figure out the correct -B values yourself just do

$ ./zoomto.sh 640x480 384x288 -B 6,8

The script also calculates fitting -j options if the input size is not a multiple of 32. Same is true for -Y if output size is not a multiple of 32
$ ./zoomto 643x480 384x288 -j 0,2,0,1 -B 6,8

If your input size is a multiple of desired output the script now outputs a -r option (instead of -B) since its faster than -B

$ ./zoomto.sh 768x512 256x256 -r 2,3

The -j and -Y options generated always align to the nearest n*32 boundary. This means they can be negative (adding black bars). A full featured example:

$ ./zoomto.sh 702x512 638x475 -j 0,-1,0,-1 -B 1,2 -Y 3,1,2,1

v4l loopback kernel module hacks

Disclaimer: I just hacked on vloopback, I did not write it. But since the author http://motion.technolust.cx/vloopback/index.html (dead site) doesn't has responded to my mails I am providing the patches here. So if you use code from here, mail me contact not him.

NEW (2003-11-06)
The project moved from the technolust site to sourceforge, you'll find updated version at http://motion.sourceforge.net and the module at http://motion.sourceforge.net/vloopback/

Fixed a few things in the 0.90 version of this module, especially the dev_offset insmod parameter and the zero copy mode. Also be more tolerant to applications who send uninitialized structures.

I tested on a SMP x86 box with 2.4.19 and devfs so your mileage may vary.

Read the unified diff output here: patch-vloopback-0.90
Fetch the gzipped tar file here: vloopback-0.90-tibit.tar.gz

mplayer vo_v4lw module

Patch to mplayer-0.90pre6 is vo_v4l-patch-04-09-2002.p1

Quick v4lw loopback howto:

NOTES:

Performance: System: 2 * 1GHz Intel PIII (Coppermine) #SMP
MPEG1 at 768x576: mplayer CPU Usage ca. 35%, xawtv 11%
Divx at 512x384: mplayer CPU Usage ca. 20%, xawtv 10%