Very nice sripty, well done!
Can I put subtitles in the same directory as the .avi to make mencode add these subtitles to the kvcd/skvcd (hardsubbed) If not is there another way to add subs ? Thanx in advance |
I was not doing subtitles or used this script for dvd authoring.
(Look into 'man mplayer' in OSD/SUB OPTIONS section and vobsubout options of mencoder)? The only thing I remember that video buffer size should be 224Kb (twice the the size of svcd video buffer) and gop should be less or equal 15 for pal and 18 for ntsc. Another way to add subtitles and menu, I guess, can be done by vcdimager .xml descriptors. If you know how to add dvd authoring to the script - do it and let us know. My priority now is to find some gui wrapper for the script, so that you don't have to edit the scrupt everytime before use. Also, it would be helpful to add features like source analysis before encoding; it can be done by mplayer -v -identify options and -cropdetect. |
Sorry but I lack the coding skills to help you out with a GUI wrapper or vcdimager implementation for authoring (haven't used xml yet)
But it would be great to see this script with a usefull GUI to avoid changing settings all the time indeed. One short question: is it possible to use this script for encoding to 2 CD's as well? Imho movies >120 minutes look a lot better when you make it a 2 CD skvcd rip. I hope that's not that hard to ask, And thanx again.. |
The script splits the resulting .mpg .bin .cue files automatically according CDSIZE variable.
That's why mpeg file produced by mencoder has to be de-multiplexed into video and audio and then multiplexed again by external multiplexer (mplex or tcmplex) with usage of CDSIZE break point. (Maybe this can be done by mplayer itself, by counting frames and determing the stream size.) If mpeg produced by mencoder is fit for single CD, you can just pass it to vcdimager to produce .bin and .cue files. (Meanwhile I use separate audio encoding by toolame with variable audio bitrate and normalize sound level, but it is not necessary; i just found that the quality of soundtrack is better with this separate audio encoding). |
What I actually mean is: can I set cdsize to something like CDSIZE=1600 #(2x 795MB to fit on 2 700 MB cdr's) so that it encodes to an mpeg with increased bitrate & quality to fit on 2 cd's.
Or is this script/mencoder limited to these 3 settings only? Code:
#CDSIZE=735 # 74min CD Would it also be possible to use this script in order to try using kdvd templates to create Res : 720x480 rips ? Or doesn't it make sense using this script for this purpose. eg: Code:
ASPECT="1.7777" /me hopes no to bother too much with asking all these questions ;) |
The script does not calculate quality (or video bitrate in earlier versions) for CD size and their numbers, because it is simply not possible to predict the size of resulting mpeg file accurately.
However, it is not a big drama: chose AUDIORATE constant and any constant quality, start the script and watch mencoder output bottom line - it displays estimated completion time, estimated final size and current birates. I recommend to run it at least for 10% of encoding, it displayes in brackets after current fame number. Then you choose quality in command line according desired final size. (For variable audio rate initial encoding is 384Kbs, but resulting variable audio is usually can be around 160Kbs, so you need to do simple math :D) |
can't execute script - russiansexpat
I am visitor from the "linux media" forum and thought I'd get a few ideas from here.
I tried your script but can't get it to work. I left it pretty much alone and only commented and uncommented a few lines. When I do "./[name of script] [file.avi], I get the following message: Usage: $HOWCALLED <shrunk name> <file or mplayer source> [variable video bitrate kbs [$VBITRATE]]" "result: (S,X)VCD and mpeg(1,2) encoded with $HOWCALLED." or something close...I copied this message from the script as it is the closest. I'm away from my linux box now. Here is a copy of the script if you care to look. As I said, I only changed a few "#" to make it work for the file. ------------------------------------------------------------------------------------- #!/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 mplayer ffmpeg tcmplex vcdimager cdrdao for exe in mencoder mplayer ffmpeg tcmplex vcdimager 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\ " VBITRATE=1152 # 1 = 1000 bits #---------- below you can edit parameters ---------- SWS=0 # fast bilinear #SWS=2 # bicubic (for upscaling) #SWS=9 # lanczos (quality? slow) VFILTER="denoise3d,eq2," #FPS=",telecine,lavcdeint -fps 29.97 -ofps 29.97" FPS=" -ofps 29.97" # NTSC #FPS=" -ofps 25" # PAL #FPS=" -ofps 23.976" # NTSC pulldowned #FPS=",ivtc=1 -ofps 23.976" #FPS=" -ofps 10" # must for variable and progressive fps # for vcd WID=352 HEI=240 #HEI=288 VCODEC=mpeg1video AUDIORATE=128 MUXMODE="-m 1 -F tcmplex.tmp" IMAMODE="-t vcd2" # for svcd #WID=480 #HEI=480 #HEI=576 #VCODEC=mpeg2video #AUDIORATE=224 #MUXMODE="-m s -F tcmplex.tmp" #IMAMODE="-t svcd" LAVCOPTS=":vlelim=-4:vcelim=7:lumi_mask=0.05:dark_mask=0.01" PASS="single" #PASS="1st 2nd" NOTverbose="2> /dev/null" #NOTverbose="&> /dev/null" #CDSIZE=735 # 74min CD CDSIZE=130 # 80min CD #CDSIZE=895 # 90min CD CDOPT="--force --reload --eject" CDDEV="--device 0,0,0" #---------- above you can edit parameters ---------- function usage() { echo echo "Usage: $HOWCALLED <shrunk name> <file or mplayer source> [variable video bitrate kbs [$VBITRATE]]" echo echo "result: (S,X)VCD and mpeg(1,2) encoded with $HOWCALLED." echo exit 1 } 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 VBITRATE=$1 shift 1 fi COMMAND_LINE_MENCODER=$* rm -rf divx2pass.log rm -rf frameno.avi for word in $PASS ; do VIDEO="video.mpg" [ "$word" == "single" ] && pass="" [ "$word" == "1st" ] && pass=":vpass=1" [ "$word" == "1st" ] && VIDEO="/dev/null" [ "$word" == "2nd" ] && pass=":vpass=2" command="mencoder -sws $SWS -vf ${VFILTER}scale=$WID:-3,expand=0:$HEI${FPS} \ -forceidx -of mpeg -nosound \ -ovc lavc -lavcopts vcodec=$VCODEC:$MATRIX:mbd=2:vbitrate=$VBITRATE:vr c_minrate=300:vrc_maxrate=2300:vrc_buf_size=320:ke yint=25${LAVCOPTS}$pass \ $COMMAND_LINE_MENCODER $FILE -o $VIDEO" echo "$command $NOTverbose" eval "$command $NOTverbose" done rm -rf $NAME.mpv eval "mplayer -noframedrop -vc dummy -vo null -dumpvideo -dumpfile $NAME.mpv $VIDEO &> /dev/null &" AUDIO="audio.wav" rm -f $AUDIO mkfifo -m 660 $AUDIO eval "mplayer -noframedrop -vc dummy -vo null -ao pcm -waveheader -aofile $AUDIO $FILE &> /dev/null &" eval "ffmpeg -y -i $AUDIO -ab $AUDIORATE -ar 44100 -ac 2 -f mp2 $NAME.mpa &" #eval "lame -h --abr $AUDIORATE --resample 44.1 - $NAME.mpa < $AUDIO &" wait rm -f $VIDEO rm -f $AUDIO rm -f $NAME??.mpg echo "maxFileSize = $CDSIZE" > tcmplex.tmp eval "tcmplex $MUXMODE -i $NAME.mpv -p $NAME.mpa -o $NAME.mpg" rm -f tcmplex.tmp for i in $NAME??.mpg; do cue="`basename $i .mpg`.cue" bin="`basename $i .mpg`.bin" rm -f $cue $bin eval "vcdimager $IMAMODE -c $cue -b $bin $i" done echo -e "\n$HOWCALLED encoding is completed in $SECONDS seconds.\n" for cue in $NAME??.cue; do bin="`basename $cue .cue`.bin" echo "PLEASE INSERT BLANK CD IN CD-WRITER, after a keypress we start:" read -n 1 null eval "cdrdao write $CDOPT $CDDEV $cue" echo "CD WRITING IS COMPLETED." done exit 0 # last line of this script :idea: :idea: :arrow: :idea: |
Simply your usage was wrong.
Example: ./name_of_the_script result_base file.avi 5 will produce the resulting files with result_base names from source file.avi and quality=5. |
Simply your usage was wrong.
Example: ./name_of_the_script result_base file.avi 5 will produce the resulting files with result_base names from source file.avi and quality=5. |
I think you didn't use the latest version of mencoder and all other required software.
At least I didn't check my version of mplayer before running the script and I got the same output. maybe this'll help. russiansexpat; what will be the difference fo your script when it's build in a programm like avidemux as gui, compared with the kvcd conversion that is already available? is there a difference or is it the same? |
#(rpm -qa | grep mplayer | sort ; rpm -qa | grep mencoder)
mozilla-plugin-mplayer-1.0pre2-2 mplayer-1.0pre3-1 mplayer-codecs-extralite-1.0-1 mplayer-codecs-linux-real-9.0-2 mplayer-codecs-linux-xanim-1.1-1 mplayer-codecs-linux-xanim-3ivx-1.1-1 mplayer-codecs-win32-1.1-1 mplayer-codecs-win32-dmo-9.0-2 mplayer-codecs-win32-indeo-1.1-1 mplayer-codecs-win32-mjpeg2k-1.0-2 mplayer-codecs-win32-qt-6.0-2 mplayer-codecs-win32-qt-extras-1.1-1 mplayer-common-1.0pre3-1 mplayer-font-cp1250-1.1-1 mplayer-font-iso1-1.1-1 mplayer-font-iso2-1.1-1 mplayer-font-iso7-1.1-1 mplayer-font-iso9-1.1-1 mplayer-font-koi8r-1.1-1 mplayer-gui-1.0pre3-1 mplayer-skin-default-1.0-2 mplayer-skin-slim-1.0-2 mplayer-tools-1.0pre3-1 mplayer-vidix-1.0pre3-1 mplayer-vidix-nvidia-1.0pre3-1 mencoder-1.0pre3-1 # I use both mplayer and mencoder version -1.0pre3-1 from rpm binaries for RedHat Linux. It could be a problem with parsing command line if you use other compiled versions, but it is not difficult to figure it out at your end. Check what shell do you use to run the script; it is bash script and also it can be run from shell (bourne shell) but not ksh or csh. Try to run "sh -x scriptname resultname sourcename 6" There is a topic http://www.kvcd.net/forum/viewtopic.php?t=8017 where I am asking for volunteers to develop simple gui for example in tcl/tk for the script. At this moment I don't have enough resources (brains and time) to do it myself. |
**ERROR: [mplex] Too many frame drops -exiting
I'm trying to make a SVCD with the menkoder script posted here, but when mplex runs I get a lot of warnings like this:
++ WARN: [mplex] Stream e0: data will arrive too late sent(SCR)=25198602 required(DTS)=7261342 ++ WARN: [mplex] Video e0: buf= 112397 frame=001925 sector=00002237 and finally : **ERROR: [mplex] Too many frame drops -exiting and the mpg doesn't get builded. I'm using mplayer and mencoder 1.0pre3 and mplex 1.6.1.92, the version of menkoder is 0.2. Somebody also gets this problem ? |
I have had a long struggle with these errors.
Usually they appear when the source has problems with a frame rate. Try to specify explicitly FRC parameter with -fps and -ofps (you have to know frame rate of your source); if it does not help, then try FRC with filmdint (aka reverse telecine) parameter. Alternatively, chose a constant audio rate and use tcmplex instead of mplex; tcmplex does not produce these kind of errors, but check audio/video sync of the result. |
W/ version 0.2 I have same problem ...
My audio not sync w/ video ..in constant bit rate .. in variable bit rate i have error in mplex ... dpkg -l|egrep mjpe\|toolame\|normali\|mencoder\|mplayer\|ffmp\|v cd |awk '{print $2,"\t"$3}' ffmpeg 0.4.8-sarge0.0 libmjpegtools0 1.6.1.92-0.1 mencoder-k7 1.0-pre3-0.0 mjpegtools 1.6.1.92-0.1 mplayer-fonts 3.3-0.1 mplayer-k7 1.0-pre3-0.0 normalize 0.7.6-3 toolame 02i-2 vcdimager 0.7.14-1 vcdtools 0.4-2 anybody can help-me ? |
I don't have these errors to fatal extent, so I've been able to multiplex video and audio by mplex.
De-multiplexing part of the code is here: Code:
if [ $AUDIORATE != 384 ]; then without de-mux and re-mux. (Unfortunately, then you don't have ability to split the result into multiple CDs, so $MOVIE should be less $CDSIZE to fit single CD). I appreciate your feedback. Thanks |
I have solved my problem :D
problem is FPS .... #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 only, work w/ this FRC .... russiansexpat |
Quote:
I'm also having difficulties trying to understand why the sound is resampled to 48 kHz. I thought VCD/SVCD is 44.1 kHz, or is the 48 kHz also related to KSVCD? Last one: I just tried to make a very simple GUI, which isn't that hard (glade/python), but I can hardly test it if I can't even encode video myself :-( |
Quote:
Finally, I've used tcmplex with constant audio rate, and it worked ok, with audio/video synced all the movie. Another thing I dont understand of the menkoder script, is why first encode the audio with mencoder, then generate a .wav, and then again encode it with toolame ? Is for something related to the frame rate ? Why not dump the original audio to .wav and then encode with toolame ? Each encode looses quality. Regards |
If your source is avi file, then it has header and this header can be wrong
(and real frame rate = number_of_frames/movie_time can be different) because it was encoded with corrupted encoder. avi files are not original sources - original sources are mpeg or analog video. transcode has tools to analyze source and fix avi header: tcprobe, tcscan and avifix, but transcode itself is very-very slow encoder. Try FRC="-fps 25 -ofps 25 -vf filmdint=fast=3," it will de-interlace the source and do frame rate conversion regardless. 48 KHz frequency aduio was discussed earlier - it is a limitation of mp2 variable rate encoding, see http://mikecheng.d2.net.au/layer2/vbr.html You can have variable audiorate encoding in 44.1KHz and stereo 192-384kbps bitrate range. Standalone DVD players accept 48KHz and all standalones I've tried play variable mp2 also, so I chose 48KHz because of wider bitrate band 112-384kbps. Quote:
If you dump .wav from the source, and encode video separately, it is another risk of adio/video being not in sync. Maybe it is a time to sipmplify the script (as mentioned already) - not de-mux and then re-mux audio and video, but instead just pass $MOVIE result file from mencoder straight to vcdimager and use only fixed audiorate. Mpeg files can be splitted by mpgtx tool according to $CDSIZE, see http://mpgtx.sourceforge.net/ |
Quote:
Quote:
As I sidenote, I like VBR, so I'd opt to leave it in the script. Not because it sounds better (haven't done any comparison), but because I think the technique is nice... |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.