How do i run a command line exe from within visual basic passing parameters to it?

Posted on 2008-11-05
Last Modified: 2013-11-18
Okay, what i'm doing here is working on a program that needs to use ffmpeg to convert a wma file to mp3.
what i'm needing to do though is call something like this from within my VB application.

C:\ffmpeg.rev12665>ffmpeg -i test.wma -vn -f wav - | lame --resample 32 -
b 40 -B 40 --cbr -f --priority 4 -m s - test.mp3

i simply need VB to be able to launch that externally basically.

i really need to convert the wma samplerate to different samples like 22,050 so flash will stream it properly.
i would purchase something to get this done and i was looking at this:

only problem with that is that it doesn't allow you to change the sample rate for mp3...only wav.

can anyone help me with this or know of an activex object i can purchase that will do this?
Question by:linuxrox
    LVL 11

    Accepted Solution

    LVL 1

    Expert Comment

    if all you want to do is run it externally, use the shell command:


    replace the C:\Users\ with the path

    Author Comment

    Hey, I tried the following and this doesn't work:

    ShellExecute Me.hwnd, vbNullString, "C:\ffmpeg.rev12665\ffmpeg.exe", "-i C:\ffmpeg.rev12665\localbreak2.wma -vn -f wav - | C:\ffmpeg.rev12665\lame --resample 22.05 -b 40 -B 40 --cbr -f --priority 4 -m s - C:\ffmpeg.rev12665\localbreak2.mp3", "C:\ffmpeg.rev12665\", SW_SHOWNORMAL

    but when i paste this into a command prompt it does work:

    C:\ffmpeg.rev12665\ffmpeg.exe -i C:\ffmpeg.rev12665\localbreak2.wma -vn -f wav - | C:\ffmpeg.rev12665\lame --resample 22.05 -b 40 -B 40 --cbr -f --priority 4 -m s - C:\ffmpeg.rev12665\localbreak2.mp3

    any ideas?

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now