digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Video Encoding and Conversion (http://www.digitalfaq.com/archives/encode/)
-   -   KVCD using Menkoder? (http://www.digitalfaq.com/archives/encode/6958-kvcd-menkoder.html)

istevens 02-05-2004 04:39 PM

I think I have found the problem. One of the AVIs giving me errors has a frame rate of 23.976fps (NTSC pulldown) and the other has one of 25fps (PAL) and I was using an fps of 29.97.

Am I able to convert PAL to NTSC simply by decreased the framerate or will I still get synch problems? If I do not lower the framerate of a PAL source to NTSC will the resulting KVCD play properly on my DVD player? I guess there's only one way to fine out, eh? :)

It would be nice if the FRC parameters were abstracted to a command-line parameter, eg. menkoder [base] [source] [quality] [source fr] where [source fr] is one of
  • NTSC = 23.976 fps
    NTSCFILM = 29.97 fps
    PAL = 25 fps

russiansexpat 02-06-2004 06:12 AM

Check this first:
http://www.kvcd.net/forum/viewtopic.php?t=7771&start=62
and try to avoid changing frame rate, i.e. choose resulting frame rate equal to source frame rate, if possible.
(and if you change frame rate, you have to use FRC with telecine or filmdint parameters).

otzi 02-08-2004 09:21 PM

Russianexpat, howto can i convert any videos example to 23.976 fps and make audio syncronous ?

I can make this :(

russiansexpat 02-09-2004 05:35 AM

You try to use frame rate conversion from NTSC to NTSC pulldowned:
FRC="-fps 29.97 -ofps 23.976 -vf filmdint=fast=3,"
If it is a PAL source 25 fps, I would suggest to leave the result in PAL:
FRC="-vf "
or
FRC="-fps 25 -ofps 25 -vf "
Also, check audio sample rate; audio resampling can produce sound distortions.

otzi 02-11-2004 07:15 AM

Russianexpat, I testing this and this working full... i not have more problem with sound delay.

Code:

FRAMES=`tcprobe -d0 -H 10 -i $2 |grep frame.rate|awk '{print $4}'`
FRC="-vf " # fps not changed

if [ $FRAMES == 25.000 ]; then
        FRC="-fps 25 -ofps 25 -vf "
fi

if [ $FRAMES == 29.970 ]; then
        FRC="-fps 29.97 -ofps 29.97 -vf "
fi

if [ $FRAMES == 23.976 ]; then
        FRC="-fps 23.976 -ofps 23.976 -vf "
fi

but, i not like use tcprobe ... have another method to get FPS ?


Other question, have method to create chapters ?

thx my friend.

Peder 02-27-2004 10:07 AM

640x272 -> 4:3 letterboxed SVCD
 
Hi and thanx for a great script.

There's something, however, I haven't really got:
I've got an avi that's 640x272 and I'd like menkoder to give me a 4:3 letterboxed SVCD.
From what I understand using the recomended ASPECT="2.35" will get me a full blown 4.3 image,
when mplaying the .mpg it seems to be that way at least.
I haven't burned the bin/cue (or even menkoded the whole movie) yet.

Have I got the above wrong or do I need to dribble with crop/expand (which I really don't understand fully in the first place) ?

Regards,
Peder

russiansexpat 02-28-2004 02:36 AM

Your source aspect is 640/272=2.35 because for AVI files
view aspect is equal to pixels ratio.
(for mpeg files, on the other hand, aspect view is stored in a header and is not the same as pixel ratio).
Read these pages:
http://hkfanatic.com/widescreen/
http://www.uwasa.fi/~f76998/video/conversion/
and you have to do letterboxing or/and pan&scan
if you want to change aspect view to 4/3.

Peder 02-29-2004 07:30 AM

Well, I ended up using http://dvdripping-guid.berlios.de/en...ncoder-quantum with some modifications instead and that worked well
(except for some choppy audio, but that might have been my CDRW-disc. I'll try a CDR next and see what happens).

Edit: Nope, the choppy audio remains albeit to a lesser extent. Have to search the forums a bit methinks.

- P

sertinell 04-11-2004 06:37 PM

Hello. are somebody here ?

I spanish excuse my bad english please
I have opened a post in spanish forum about same.http://www.kvcd.net/forum/viewtopic.php?p=72937

I'm trying this script
Code:

#!/bin/bash
#
# Copyright (C) 2003-2038 russiansexpat
#
# script:      mpeg(1,2,3,4) conversion to (S,X)VCD with quantisation matrix
#              and auto-splitting into multiple CDs and writing them.
#
# requires:    mencoder(1.0pre3) mplayer mplex vcdimager cdrdao
# optional:    normalize toolame(0.2k)
#
# does not require: microsoft. This script has not been tested on animals.
#
# version 0.3
#
# Changeslog
#
# - Added subtitle suport (Alexandre Possebom(otzi))
#

for exe in mencoder mplayer mplex vcdim
ager cdrdao; do
  if [ -z "`which $exe`" ]; then
      echo "ERROR: $exe must be in your path $PATH"
      exit 1
  fi
done

MATRIX="\
intra_matrix=\
8,9,12,22,26,27,29,34,\
9,10,14,26,27,29,34,37,\
12,14,18,27,29,34,37,38,\
22,26,27,31,36,37,38,40,\
26,27,29,36,39,38,40,48,\
27,29,34,37,38,40,48,58,\
29,34,37,38,40,48,58,69,\
34,37,38,40,48,58,69,79:\
inter_matrix=\
16,18,20,22,24,26,28,30,\
18,20,22,24,26,28,30,32,\
20,22,24,26,28,30,32,34,\
22,24,26,30,32,32,34,36,\
24,26,28,32,34,34,36,38,\
26,28,30,32,34,36,38,40,\
28,30,32,34,36,38,42,42,\
30,32,34,36,38,40,42,44\
"

Q="6" # constant video quality
      # best=2 excellent<=4 good<=7 even=11 for mpeg1  VCD resolution
      #        excellent<=6 good<=9 even=13 for mpeg2 SVCD resolution

#---------- below you can edit parameters ----------

# audio bitrate
AUDIORATE=112 # constant
#AUDIORATE=384 # variable with frequency 48kHz in 112-384kbs band

# frame rate conversion (has to be first in processing chain)
#FRC="-fps 29.97 -ofps 29.97 -vf telecine,lavcdeint," # example to increase fps
#FRC="-fps 29.97 -ofps 29.97 -vf "                    # NTSC
FRC="-fps 25 -ofps 25 -vf "                          # PAL
#FRC="-fps 23.976 -ofps 23.976 -vf "                  # NTSC pulldowned
#FRC="-fps 29.97 -ofps 23.976 -vf filmdint=fast=3,"  # example to decrease fps
#FRC="-vf " # fps not changed

# video filters
#vfilter="pp=de,denoise3d,eq,"

# aspect view of output;
# it should be the same as aspect view of the source mpeg(1,2)
# or equal to width/length if source aspect undefined (example: avi, capture)
# and your player has to be capable to process chosen aspect
#
#ASPECT="1" # 1:1 where have you seen square TV ?!
ASPECT="1.3333" # 4:3 standard TV or monitor
#ASPECT="1.7777" # 16:9 wide screen TV
#ASPECT="1.85" # film academy flat
#ASPECT="2.35" # cinema scope

#crop="crop=320:240,"    # crop, cut out black bands
#expand="expand=320:240," # expand to match aspect view, black bands added

# for xvcd
#XY="352:240"
XY="352:576"
VCODEC=mpeg1video
VBuffer=376 # Kbits = 46*1024*8/1000
#MUXMODE="-f 2 -V -b 46"
#IMAMODE="-t vcd2"

# for svcd
#XY="480:480"
#XY="480:576"
#VCODEC=mpeg2video
#VBuffer=917 # Kbits = 112*1024*8/1000
MUXMODE="-f 5 -V -b 112"
#IMAMODE="-t svcd"

# scaling algorithm
#SWS=0 # fast bilinear
#SWS=2 # bicubic, for upscaling
SWS=9 # lanczos, quality

# macroblock decision algorithm
#MBD=0 # compare blocks, fast
#MBD=1 # fewest bits
MBD=2 # best rate distortion

# group of pictures length - the longer is better compression, but
# it relies on a player decoder and so resulting playback quality
GOP=25 # dvd pal gop <=15, ntsc <=18 but in practice gop can be longer

# various mencoder -lavcopts parameters
ulavcopts1=":vmax_b_frames=2:vb_strategy=1:vqblur=0.3:vqcomp=0.7:vrc_eq=tex"
ulavcopts2=":naq:lumi_mask=0.05:dark_mask=0.01:tcplx_mask=0.1:scplx_mask=0.1"
ulavcopts3=":preme=1:precmp=2:cmp=2:subcmp=2:mbcmp=2:predia=2:dia=2:trell:cbp"

PASS="single"
#PASS="1st 2nd"

# mencoder verbosity
#NOTverbose="2> /dev/null"
#NOTverbose="&> /dev/null"

#CDSIZE=735 # 74min CD
CDSIZE=795 # 80min CD
#CDSIZE=895 # 90min CD

# cdrdao parameters
CDOPT="--overburn --reload --eject"
CDDEV="--device 0,1,0" # SCSI id

# Subtitle settings
blur=4
subpos=75
textscale=4
outline=4
autoscale=2

#---------- above you can edit parameters ----------
FILE=$2
tmp=`echo $FILE | sed s/\....$//`
SUB=""
[ -f "${tmp}".sub ] && SUB="-sub ${tmp}.sub -subpos ${subpos} -subfont-autoscale ${autoscale} -subfont-outline ${outline} -subfont-text-scale
${textscale}"
[ -f "${tmp}".srt ] && SUB="-sub ${tmp}.srt -subpos ${subpos} -subfont-autoscale ${autoscale} -subfont-outline ${outline} -subfont-text-scale ${textscale}"
tmp=""



function usage() {
  echo
  echo "Usage:  $HOWCALLED <shrunk name> <file or mplayer source> [quality [$Q]]"
  echo
  echo "qualilty: best=2 excellent<=4 good<=7 even=11 - XVCD"
  echo "                excellent<=6 good<=9 even=13 - SVCD"
  echo
  echo "result: (S,X)VCD and mpeg(1,2) encoded with $HOWCALLED."
  echo
exit 1
}

# command line parsing
HOWCALLED=`basename $0`
[ $# -lt 2 ] && usage

case $1 in
  -*)
      usage
  ;;
  *)
      NAME=$1
      shift 1
  ;;
esac

DIR="`pwd`"
FILE=$1
if [ "$1" == "`basename \"$1\"`" ]; then
  FILE="$DIR/$1"
fi
shift 1

if [ "$1"x != "x" ]; then
  Q=$1
  shift 1
fi
COMMAND_LINE_MENCODER=$*

# encoding
rm -f divx2pass.log
rm -f frameno.avi

for word in $PASS ; do
  MOVIE=$NAME.mpg
  [ "$word" == "single" ] && pass=""
  [ "$word" == "1st"  ] && pass=":vpass=1"
  [ "$word" == "1st"  ] && MOVIE="/dev/null"
  [ "$word" == "2nd"  ] && pass=":vpass=2"

  command="mencoder $SUB \
  -forceidx -srate 44100 -af resample=44100 \
  -lavdopts er=1:idct=0 $FRC${vfilter}${crop}${expand}scale=$XY -sws $SWS \
  -of mpeg -oac lavc -ovc lavc \
  -lavcopts acodec=mp2:abitrate=$AUDIORATE:aspect=$ASPECT:vcodec=$VCODEC:$MATRIX:idct=0:mbd=$MBD:vqscale=$Q:vrc_minrate=300:vrc_maxrate=2300:vrc_buf_size=$VBuffer:keyint=$GOP${ulavcopts1}${ulavcopts2}${ulavcopts3}$pass \
  $COMMAND_LINE_MENCODER $FILE -o $MOVIE"

  echo "$command $NOTverbose"
  eval "$command $NOTverbose"
done

echo -e "\nyou will wait :p\n"

if [ $AUDIORATE != 384 ]; then
  # fixed audio rate
  eval "mplayer -noframedrop -dumpvideo -dumpfile $NAME.mpv $MOVIE $NOTverbose "
  eval "mplayer -noframedrop -dumpaudio -dumpfile $NAME.mpa $MOVIE $NOTverbose "
else
  # re-encoding into variable audio rate
  eval "mplayer -noframedrop -srate 48000 -dumpvideo -dumpfile $NAME.mpv $MOVIE $NOTverbose"
  AUDIO=$NAME.wav
  ###rm -f $AUDIO
  ###mkfifo -m 660 $AUDIO
  eval "mplayer -noframedrop -vc dummy -vo null -ao pcm -waveheader -af resample=48000 -aofile $AUDIO $MOVIE $NOTverbose"
  eval "normalize -v --fractions $AUDIO" # normalize can't work from pipe
  command="cat $AUDIO | toolame -s 48 -m s -v -1 - $NAME.mpa"
  echo "$command"
  eval "$command"
fi

wait

#rm -f $MOVIE
#rm -f $AUDIO
# end of encoding

# multiplexing
#rm -f $NAME?.mpg
eval "mplex $MUXMODE -S $CDSIZE -o $NAME%d.mpg $NAME.mpv $NAME.mpa"
#rm -f $NAME.mpv $NAME.mpa

exit 0
# last line of this script

And I have this error:
Code:

$ ./ofkvcd.sh corte.avi
./ofkvcd.sh: line 21: syntax error near unexpected token `ager'
./ofkvcd.sh: line 21: `ager cdrdao; do'

Wath is the problem? Sorry I am rokkie in linux

Thanks !! from spain

P.S. If you understand the post try to read in spanish please.

rds_correia 04-11-2004 06:53 PM

Hola amigo,
Eres mejor intentares en el foro dedicado a Mencoder.
http://www.kvcd.net/forum/viewforum.php?f=68
Un Saludo.

sertinell 04-12-2004 08:28 AM

Ok Iposted here because i found the script here.

Thanks!!

P.S. Gracias por responderme en español :D

ghubsch 04-27-2004 09:37 AM

Error: option 'oac' has no suboption 'lavc'
 
After using the script posted here for a while, now (maybe after some software upgrades) I get the error message posted at the subject, and don't have a clue how to solve it :oops:

Can anybody help ?

Here's my complete output:
Code:

./menkoder2vcd HowToDeal HowToDeal.avi
 mencoder -sub HowToDeal.srt -subpos 75 -subfont-autoscale 2 -subfont-outline 4 -subfont-text-scale 4    -forceidx -srate 44100 -af resample=44100    -lavdopts er=1:idct=0 -fps 23.976 -ofps 23.976 -vop scale=352:288 -sws 9    -of mpeg -oac lavc -ovc lavc    -lavcopts acodec=mp2:abitrate=192:aspect=1.7777:vcodec=mpeg1video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,12,
14,18,27,29,34,37,38,22,26,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27,29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,
38,40,48,58,69,79:inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34,22,24,26,30,32,32,34,
36,24,26,28,32,34,34,36,38,26,28,30,32,34,36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44:idct=0:mbd=2:vqscale=6:
vrc_minrate=64:vrc_maxrate=3000:vrc_buf_size=376:keyint=25:vmax_b_frames=2:vb_strategy=1:vqblur=0.3:vqcomp=0.7:
vrc_eq=tex:naq:lumi_mask=0.05:dark_mask=0.01:tcplx_mask=0.1:scplx_mask=0.1:preme=1:precmp=2:cmp=2:subcmp=2:
mbcmp=2:predia=2:dia=2:trell:cbp 
 /home/xmule/Incoming/HowToDeal.avi -o HowToDeal.mpg
MEncoder 0.92-3.3.2  (C) 2000-2003 MPlayer Team

CPU: Advanced Micro Devices Athlon 4 PM Palomino/Athlon MP Multiprocessor/Athlon XP eXtreme Performance (Family: 6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Reading /home/ghubsch/.mplayer/codecs.conf: can't open '/home/ghubsch/.mplayer/codecs.conf': No such file or directory
Reading /usr/share/mplayer/codecs.conf: 50 audio & 136 video codecs
File not found: 'frameno.avi'
Reading config file /home/ghubsch/.mplayer/mencoder: No such file or directory
Error: option 'oac' has no suboption 'lavc'
Exiting... (error parsing cmdline)

Thanks in advance,

GHubsch

tetra 04-28-2004 02:30 AM

You have an older version of mplayer (0.92), you need the newer ones, like 1.0 or newer

jrs 06-15-2004 11:32 PM

russiansexpat is this the place we go to get the lastest version of you script?
It works great.

Thanks

daaugusto 09-24-2004 05:21 AM

Quote:

Originally Posted by jrs
russiansexpat is this the place we go to get the lastest version of you script?
It works great.

Thanks

Yeah! Kick ass. Let me know too.

Thanks.


All times are GMT -5. The time now is 11:21 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.