[lug] mpeg hardware encoding

Jim Buzbee James.Buzbee at echostar.com
Mon Sep 24 09:27:24 MDT 2001


Sean Reifschneider wrote:
> 

...

> 
> I was able to use some tools from the mjpeg project at sourceforge to
> create an mpeg, but was never able to get it to re-combine the audio and
> video streams.  The error I got was frequently asked about and never
> answered.  I finally gave up.
...

Here's a script that I use when converting video from my 1394 based
camcorder to mpeg 1  :

#!/bin/sh
#
# dvconvert.sh
#
# Jim Buzbee 09/23/01
#
# Hack to go from 1394 video device to video cd, format mpeg 1.
# Use for conversion to video CD format.
#
# Most, if not all, of the tools used come from the mjpeg tool set :
#
# http://mjpeg.sourceforge.net/
#
# The output of this script will be a single mpeg 1 file
# suitable for creation of a video cd using vcdimager.
# The output of that can be written to a CD using
# a tool such as cdrdao
#
# Before executing this script, grab video from 1394 device
# as follows :
#
# dvgrab --format dv2 --autosplit <base name, e.g. MyVideo>
#
# The above command will run until terminated with a <cntrl>c
#
# The following sequence of commands may have size limitations when
# converting between various formats.  I have not tested it
# with any video longer than 4-5 minutes.
#
# To execute this script, pass in the base name from the dvgrab
# above, e.g. :
#
# dvconvert.sh MyVideo
#
for i in $1* ; do

  echo "Processing $i to $i.mjpeg"
  dv2jpg $i $i.mjpeg
  rm $i

done

# Put everything into a single file.
# This may fail if the result is too large
avijoin $1-all.avi $1*.mjpeg

# Clean up, we no longer need the individual mjpegs
rm $1*.mjpeg

# Extract and convert the audio
lav2wav  $1-all.avi | mp2enc -v 1 -o $1-all_a.mpg

# Extract and convert the video
lav2yuv $1-all.avi | mpeg2enc -m 1 -b 1152 -o $1-all_v.mpg -r 32 -4 1 -2
1 -h

# We are now done with the original combined file
rm $1-all.avi

# Put the video and the audio back together
mplex -m 1 -f 1 $1-all_v.mpg $1-all_a.mpg -o $1.mpg

# We're done, clean up
rm $1-all_v.mpg $1-all_a.mpg



More information about the LUG mailing list