help removing characters for output file in shell script

hi i'm new to shell scripts and have a small problem

i am running a batch converter that returns all flash .flv files in a directory and create a png image from each one

the problem i have is the $1 variable , its ok on the first call but on the secound call $1.png , i have extra characrters that i need to strip from this element

for example on the first call of $1 it produces 997.flv on the secound call $1.png and outputs a resulting 997.flv.png

i need to strip the .flv part from 997.flv.png to return only 997.png (strip 4 characters from the end of $1 on its secound call - this whould be the same on all resulting files in a directory full of files as this shell script runs)

how can i do this, is it easy or is it complex, any help with this issue would be very usefull, i have tryed searching google, but can not fing out how to strip characters from a varablie in shell scripts

thanks in advance

This should work:

ffmpeg -i $1 -vcodec png -vframes 1 -an -ss 00:00:08 -t 00:00:01 -f rawvideo -s 320x240 /var/www/vhosts/mysite.com/httpdocs/playerimage/${1%.*}.png