Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6708391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:45:14+00:00 2026-05-26T07:45:14+00:00

when I run this command ffmpeg -i C:\user\test.wmv >C:\user\test.wmv_info.txt 2>&1 from command prompt it

  • 0

when I run this command ffmpeg -i "C:\user\test.wmv" >C:\user\test.wmv_info.txt 2>&1 from command prompt it works but when I try to the same from java file by calling the command prompt it executes all right but does not writes to the file.

Any idea why?

my java code is:

public void getInfoThroughCommandLine(String sourceFilePath) {
    try {

        String infoFile = sourceFilePath+"_info.txt";
        String command = "ffmpeg -i \""
                + sourceFilePath +"\" >"+infoFile+" 2>&1";

        // Execute the command
        Process process = Runtime.getRuntime().exec("cmd.exe /c start " + command);

        logger.info("Executing getInfoThroughCommandLine command: " + command);


                    // Read the response
        BufferedReader input = new BufferedReader(new InputStreamReader(
                p.getInputStream()));
        BufferedReader error = new BufferedReader(new InputStreamReader(
                p.getErrorStream()));

        // Parse the input stream
        String line = input.readLine();
        System.out.println("ffmpeg execution of: " + sourceFilePath);
        while (line != null) {
            System.out.println("\t***" + line);
            line = input.readLine();
        }

        // Parse the error stream
        line = error.readLine();
        System.out.println("Error Stream: " + sourceFilePath);
        while (line != null) {
                        //do somthing
                    }

    } catch (Exception e) {
        System.err.println(e);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:45:15+00:00Added an answer on May 26, 2026 at 7:45 am

    I assume you’re using getRuntime().exec() to execute?

    If so the Process object returned by it would be the one giving you access to in/out streams of the command you execute. Just read from it and write your own file.

    — edit based on discussion via comments —

    start in "cmd.exe /c start " + command would start the program in a separate window, and I guess the streams of the process are attached to that window.

    C:\Users\z000dgqd>start /?
    Starts a separate window to run a specified program or command.
    ........
    

    Try removing it. I.e.

        // Change this:
        Process process = Runtime.getRuntime().exec("cmd.exe /c start " + command);
        // to this
        Process process = Runtime.getRuntime().exec("cmd.exe /c " + command);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run this command to use ghostscript (from java) but Whether with
If I run this command in windows chrome it works fine, but on mobile
When I run this command netstat -t 1 -i 2>&1 > $NETStat_OUT_FILE & inside
I'm trying to run this command from the shell: sqlite3 salesShare1.db select UsersSale.saleSpecificProduct, UsersSale.fAtMall,
if i run this command varnishtop -i txurl that request is cacheble but not
If you run this command: $ curl -XHEAD -i -H User-Agent: myuseragent http://www.google.com HTTP/1.1
I run this command in SQL Workbench and it returns my desired results, but
When I run this command in MySQL: SELECT * FROM v WHERE v.firstname LIKE
I figure this is very easy, but I am trying to run this command
I am trying to run this command here: f = open(|ffmpeg -i /Users/joaoh82/Desktop/teste.MP4) result

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.