Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Mencoder conversion of files



TLUG,

I'm posting this here mainly because I can't find a really decent Linux oriented video editing forum. I mean, there's discussion on about video editing on Linux forums, and discussion of Linux on video editing forums, but there doesn't seem to be any one community that's really dedicated to Linux based, or open source, video editing.

If anyone knows of a good one, let me know where I might post my issue here.

In the meantime, here's the situation I'm looking for help on.

The Set Up:

I'm running Ubuntu Gutsy, 7.10, and I've got mencoder, ffmpeg, and have installed every codec I can think of (Specifics listed below).

I have a Sony HD video camera which writes everything in an uncompressed MPEG format. The camera connects by USB and behaves like an external hard disk - no need for DV capture utilities, just simple file transfers. The frame rate of the files is 30fps, and the size can be either 720X480, or 640X480.

The video camera splits video at the 2 GB mark. I'm not sure of the exact megabyte to time ratio, but usually a 40 minute to an hour recording will result in two files, the first being exactly 2 GB, and the second a little over 1 GB.

The Goals:

What I want to do is store these recordings in a smaller more manageable format, like AVI (DivX? Suggestions welcome).

Ideally, what I'd like to do is:
1. Append the files together. They are always numbered like so:
m2u00066.mpg, m2u00067.mpg, m2u00068.mpg. So, assuming that I want to merge all videos in a directory, append them in order of file number.
2. De-interlace.
3. Save in a reasonably high quality but smaller format, like an AVI. I understand that smaller file format equals some quality loss, but I don't need to preserve original quality, I just need a result that is clear.


What I've Done:
I found this script, mpg2avi, which uses mencoder to make the conversion. The results are an avi file of acceptable quality.
http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Batch_convert_MPEG_files_to_AVI_0


The problems:
1. Despite having lame installed, it keeps giving an audio codec not found error (reproduced below).
2. Does not seem to handle the 720X480 size.
3. I don't think it deinterlaces the video.
4. Has no option to append videos together.


The question:
Can these errors be resolved, and then the de-interlacing and appending functions added?


Thank you for any advice.

- - - - -

Here are the errors I am seeing:

MEncoder 2:1.0~rc2-0ubuntu1~gutsy1 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) D CPU 2.80GHz (Family: 15, Model: 6, Stepping: 2)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0x7dc70000
MPEG-PS file format detected.
VIDEO:  MPEG2  720x480  (aspect 3)  29.970 fps  9100.0 kbps (1137.5 kbyte/s)
[V] filefmt:2  fourcc:0x10000002  size:720x480  fps:29.97  ftime:=0.0334
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=740 h=480]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred colorspace: Mpeg PES)
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
Audio LAVC, couldn't find encoder for codec mp3.


- - - - -

Here are the contents of the script:

#!/bin/bash

#mpg2avi (Convert mpeg streams into high quality mpeg4 avi with mp3 audio)

#requirements: mplayer

#Begin
clear

# variables
version=0.2b

current_directory=$( pwd )
# video bitrate (1100 = around 500 MB movie size)
vbitrate=1100

echo -e "* mpg2avi v${version}"

# remove spaces
for i in *.[Mm][Pp][Gg]; do mv "$i" `echo $i | tr ' ' '_'`; done > /dev/null 2>&1 &


# remove uppercase
for i in *.[Mm][Pp][Gg]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done > /dev/null 2>&1 &


# convert mpg movies into avi's with mencoder
for i in *.[Mm][Pp][Gg]; do nice -n 10 mencoder $i -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbitrate:vhq:vqmin=2:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01 -vf pp=md -vf scale=720:480, -oac lavc -lavcopts acodec=mp3:abitrate=128 -o "`basename "$i"`.avi";echo "Conversion done";done


exit;

- - - - -

And here is some additional informational output:



dave@example.com:~$ mencoder -ovc help
MEncoder 2:1.0~rc2-0ubuntu1~gutsy1 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) D CPU 2.80GHz (Family: 15, Model: 6, Stepping: 2)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Available codecs:
copy - frame copy, without re-encoding. Doesn't work with filters.
frameno - special audio-only file for 3-pass encoding, see DOCS.
raw - uncompressed video. Use fourcc option to set format explicitly.
nuv - nuppel video
lavc - libavcodec codecs - best quality!
vfw - VfW DLLs, read DOCS/HTML/en/encoding-guide.html.
qtvideo - QuickTime DLLs, currently only SVQ1/3 are supported.
libdv - DV encoding with libdv v0.9.5
xvid - XviD encoding
x264 - H.264 encoding


dave@example.com:~$ mencoder -oac help
MEncoder 2:1.0~rc2-0ubuntu1~gutsy1 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) D CPU 2.80GHz (Family: 15, Model: 6, Stepping: 2)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Available codecs:
   copy     - frame copy, without re-encoding (useful for AC3)
   pcm      - uncompressed PCM audio
   mp3lame  - cbr/abr/vbr MP3 using libmp3lame
   lavc     - FFmpeg audio encoder (MP2, AC3, ...)
   twolame  - Twolame MP2 audio encoder
   faac     - FAAC AAC audio encoder

--
Dave M G
Ubuntu 7.10




Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links