[FFmpeg-trac] #9759(undetermined:new): Output always goes to stderr even when there are no errors.

FFmpeg trac at avcodec.org
Sun May 1 05:18:33 EEST 2022


#9759: Output always goes to stderr even when there are no errors.
-------------------------------------+-------------------------------------
             Reporter:  Randall      |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:  stderr,      |               Blocked By:
  error output                       |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Description changed by Randall:

Old description:

> Summary of the bug:
>   In my code (written in Rust) I'm running an ffmpeg command and checking
> if stderr contains text.  But when I run a command successfully text is
> always output to stderr and nothing comes from stdout.  Other command
> line tools I've used behave normally with regards to stdout and stderr
> that my code uses, so this appears to be a problem with ffmpeg rather
> than Rust.
>
> How to reproduce:
>   I run this command to combine a video and audio file:
>
> `ffmpeg -i 'bruh_video.mp4' -i 'bruh_audio.mp4' -c:v copy -c:a aac
> 'bruh.mp4'`
>
>  In Rust that code looks like
>
> ```
> let output =
>         Command::new("sh")  //(Command is std::process::Command)
>                 .arg("-c")
>                 .arg(&format!("ffmpeg -i '{}' -i '{}' -c:v copy -c:a aac
> '{}'", video_filepath, audio_filepath, final_filepath))
>                 .current_dir(&dl_folder)
>                 .output()
>                 .expect("failed to execute ffmpeg process");
>     let stdout = String::from_utf8(output.stdout).unwrap();
>     let stderr = String::from_utf8(output.stderr).unwrap();
> ```
>
> The stdout will be empty but stderr will contain all the normal output
> text.

New description:

 Summary of the bug:

 In my code (written in Rust) I'm running an ffmpeg command and checking if
 stderr contains text.  But when I run a command successfully text is
 always output to stderr and nothing comes from stdout.  Other command line
 tools I've used behave normally with regards to stdout and stderr that my
 code uses, so this appears to be a problem with ffmpeg rather than Rust.

 How to reproduce:

 I run this command to combine a video and audio file:

 `ffmpeg -i 'bruh_video.mp4' -i 'bruh_audio.mp4' -c:v copy -c:a aac
 'bruh.mp4'`

 In Rust that code looks like

 ``
 let output =
         Command::new("sh")  //(Command is std::process::Command)
                 .arg("-c")
                 .arg(&format!("ffmpeg -i '{}' -i '{}' -c:v copy -c:a aac
 '{}'", video_filepath, audio_filepath, final_filepath))
                 .current_dir(&dl_folder)
                 .output()
                 .expect("failed to execute ffmpeg process");
     let stdout = String::from_utf8(output.stdout).unwrap();
     let stderr = String::from_utf8(output.stderr).unwrap();
 ``

 The stdout will be empty but stderr will contain all the normal output
 text.

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9759#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list