FFmpeg help... deleteing original source after convering

Hey all, actually have 2 sections to this question. First i'm uploading a video and converting to FLV after the upload. This works fine, but i'm trying to take a screenshot of the flv after the conversion but it doesn't work. I do have a workaround. I take first a screenshot of the video before the conversion and then proceed to convert the video. This works fine, but i was wondering if you can capture a screen shot AND convert at the same time. 2nd and most importantly, after the conversion is done, is there anyway that i can delete the original file? I've tried deleting it in the code after the ffmpeg line, but the problem is that it deletes the original before it even gets to the conversion part. Any input would be greatly appreciated. Attached is some of the code i'm using. thanx all!

...>>> can i somehow combine the 2 wscript.run's ?  and then delete?
set wshell = server.createobject("wscript.shell")
wshell.run "ffmpeg -i " & server.MapPath("/videos/" &  newFileName) & " -f image2 -t 0.001 -ss 3 " & server.MapPath("/videos/" &  videoID & ".jpg")
wshell.run "ffmpeg -i " & server.MapPath("/videos/" &  newFileName) & " -y -ar 22050 -ab 32 -f flv -s 320x240 " & server.MapPath("/videos/" &  replace(newFileName,ext,".flv"))
      set wshell = nothing      

                      'Deletes to fast for conversion.
      set fso = server.CreateObject("scripting.filesystemobject")
            fso.deleteFile server.MapPath("/videos/" &  newFileName)
      set fso = nothing

Thanx all
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

One of the optional arguments to supply to .Run is bWaitOnReturn
object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])
If you supply True to this parameter, the command will wait until it's finished processing before it continues to the rest of the script.

So you might do something like:
wshell.run("ffmpeg -i " & server.MapPath("/videos/" &  newFileName) & " -f image2 -t 0.001 -ss 3 ", 0, True)

Hope this helps --

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sorry.. Link didn't post correctly:
engineroomAuthor Commented:
Perfect. Thanx dude!
engineroomAuthor Commented:
Are you still around? Have a quick question to ask...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Multimedia Programming

From novice to tech pro — start learning today.