PPM2RAW

Section: User Commands (1)
Updated: November 2002
Index Return to Main Contents
 

NAME

ppm2raw - Convert a PPM pipe to a Raw DV stream  

SYNOPSIS

ppm2raw [ options ] file ...  

DESCRIPTION

ppm2raw converts a PPM to a Raw DV stream.  

OPTIONS

-n
NTSC output required.
-a
Maintain aspect ratio on images following.
-s
Scale following images to the full frame size, regardless of aspect ratio
-k
Keep the image unscaled - centre and crop output as necessary (default).
-w
Wide screen output (default: off).
-p number
Number of encoder passes (default is 3 and afiact, other values are ignored - not sure if this is a bug in smil utils or libdv).
-q qno
Another funky encoder related param which doesn't seem to do anything.
-q number
Number of encoder passes.
-b colour
Use the colour triple for backgrounds - default is 000000. Format must be a hex string representing red, green, blue. For example, ffffff would be white.
-A wav
Use the wav to dub the output. The wav file must contain stereo, 16 bit samples at a frequency of 32khz, 44.1khz or 48khz.

Help Options

--help
Show help message.
 

EXAMPLES

ppm2raw needs a PPM input provided on stdin. Fortunately, many tools generate PPM on stdout.

For example, to re-encode any ffmpeg compatible file or stream format to a PAL Raw DV stream which rescales the images according to the aspect ratio of the input using the following command:

ffmpeg -i 'some-file' -f ppmpipe - |
ppm2raw -a > file.dv

For NTSC, you would add -n to the ppm2raw command.

So far, so good. You can create a raw dv stream from the images in the file. But, what happens when 'some-file' is not providing 25 frames per second? A typical encoding technique for streaming formats is to employ a 3:2 dropdown - essentially 1 video frame in 3 is dropped. While we can't recreate the missing image, we can duplicate frames using the rawmutiltiply command:

ffmpeg -i 'some-file' -f ppmpipe - |
rawmultiply 1.666 |
ppm2raw -a > file.dv

This then gives us our 25 frames per second (assuming the original input was a 25 fps PAL video which was encoded using 3:2 dropdown). Knowing when to do this is not always easy, but you will find that issues in this area come to the fore when you add audio into the mix...

So, lets assume we have an mpeg which has a high quality audio track, 3:2 dropdown for images and we want to encode that to DV:

ffmpeg -i 'some-file' -f ppmpipe - output.wav |
rawmultiply 1.666 -A output.wav |
ppm2raw -a > file.dv

Now, the audio from the input is added to our output.

This works, assuming the audio extracted by ffmpeg is a compatible format for DV (or more specifically, libdv). Currently, smilutils simply rejects incompatible audio. So if you have problems there, extract the wav separately (via ffmpeg or some other tool) and sox or some other tool to resample to something DV compatible (stereo, 16 bit samples of 32khz, 44.1khz or 48khz). For example:

ffmpeg -i 'some-file' input.wav
sox input.wav -r 44100 output.wav
ffmpeg -i 'some-file' -f ppmpipe - |
rawmultiply 1.666 -A output.wav |
ppm2raw -a > file.dv

Many, many tools have adopted the highly sensible mjpeg tools yuv format for output, and mjpeg tools themselves have provided a highly sensible y4mtoppm utility, so you can use a pipe like this to encode mjpeg yuv streams:

lav2wav -o output.wav
lav2yuv 'lav-input' |
y4mtoppm |
ppm2raw -a -A output.wav > file.dv

Obviously, any of the yuv tools (yuvscaler, yuvdenoise, yuvcorrect etc) can be placed prior to the y4mtoppm command.

Note that the -A switch is used on the ppm2raw tool this time, and rawmultiply isn't shown.  

SEE ALSO

smilutils(1)  

AVAILABILITY

See http://users.pandora.be/acp/kino/ for the latest version.  

AUTHORS

ppm2raw was written by Charles Yates <charles.yates@pandora.be>.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
SEE ALSO
AVAILABILITY
AUTHORS

This document was created by man2html, using the manual pages.
Time: 12:51:00 GMT, December 08, 2002