#!/bin/sh

EXE=~/nes/fceu/fce
FLAGFILE="`pwd`/s.status"

# Which file do you want to place your audio and video in.
VIDEO_RESULT="`pwd`/test0.avi"

#SL="-slstart 8 -slend 231"
SL="-slstart 0 -slend 239"

VIDEO="-ovc x264 -x264encopts crf=0:me=dia:turbo=2:frameref=4"
AUDIO="-oac mp3lame -lameopts mode=3:preset=45:aq=0"
VIDEO="$VIDEO -vf decimate=60:64:128:1 -nocache"

VIDEO="mencoder \
        - -o '$VIDEO_RESULT' \
        -mc 0 -aspect 4/3 \
        NESVSETTINGS \
        $VIDEO \
        $AUDIO \
        >& mencoder.log"
$EXE $SL -xscale 1 -yscale 1 -pal 0 -nothrottle 1 -soundq 1 -sound 48000 \
	-no8lim 1 \
	-videolog "$VIDEO" \
	-cpalette ASQUIRE6.PAL \
	$*
# Adjust the frame timing / NTSC:
riffdump -nmovi -mfps=60.098813897440515532 -mscale=655171 "$VIDEO_RESULT" >& /dev/null
