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 6124417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:07:49+00:00 2026-05-23T16:07:49+00:00

In my main process, i create a ffmpeg child process using CreateProcess(…). I need

  • 0

In my main process, i create a ffmpeg child process using CreateProcess(…).
I need to track the status of converting progress to update a progress bar. To do it, I read text from ffmpeg output and extract progress status from it.

I make a sample programm like this:

HANDLE rPipe, wPipe;
CreatePipe(&rPipe,&wPipe,&secattr,0);

STARTUPINFO sInfo; 
ZeroMemory(&sInfo,sizeof(sInfo));
PROCESS_INFORMATION pInfo; 
ZeroMemory(&pInfo,sizeof(pInfo));
sInfo.cb=sizeof(sInfo);
sInfo.dwFlags=STARTF_USESTDHANDLES;
sInfo.hStdInput=NULL; 
sInfo.hStdOutput=wPipe; 
sInfo.hStdError=wPipe;

// pStr contain ffmpeg command
CreateProcess(0,(LPTSTR)pStr,0,0,TRUE,NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW,0,0,&sInfo,&pInfo);
CloseHandle(wPipe);

BOOL ok;
do
{
    memset(buf,0,bufsize);
    ok=::ReadFile(rPipe,buf,100,&reDword,0);
    result += buf;            
}while(ok);

But I couldnt get “result” interactively updated. My app is held during conversion, and “result” string update only after ffmpeg’s process finish.

How can I have my main process and ffmpeg’s run simultaneously, and interactively read from/write to ffmpeg process’s output/input?

Thanks for your time!

LRs

  • 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-23T16:07:50+00:00Added an answer on May 23, 2026 at 4:07 pm

    If the ffmpeg just uses stdout without explicitly flushing the output then it may not get sent to the calling process until it ends

    Child processes that use such C run-time functions as printf() and
    fprintf() can behave poorly when redirected. The C run-time functions
    maintain separate IO buffers. When redirected, these buffers might not
    be flushed immediately after each IO call. As a result, the output to
    the redirection pipe of a printf() call or the input from a getch()
    call is not flushed immediately and delays, sometimes-infinite delays
    occur. This problem is avoided if the child process flushes the IO
    buffers after each call to a C run-time IO function. Only the child
    process can flush its C run-time IO buffers. A process can flush its C
    run-time IO buffers by calling the fflush() function.

    http://support.microsoft.com/kb/190351

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a progress bar that will work asynchronously to the main
I want to offload a block of code in my main process to child
I have to write program that create process using pipe() . My first task
this is my log output INFO main digestemails - process inbox INFO main digestemails
I've been trying to understand Process.MainWindowHandle . According to MSDN; The main window is
The main user-case is: Create the 2D floor plan See the 3D view of
I create a linked list dynamically and initialize the first node in main(), and
I am trying to automate our build/deployment process. So far I am using: a
I've been trying to pass an object to my main thread process but it
I'd like to create a new process which will clean up after itself, even

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.