I want to find video file duration only with ffprobe but

ffprobe FILENAME.EXT 2| find "Duration:" 

does not filter output to show just the line with "Duration:" Instead, I got:

Argument '2' provided as input filename, but 'FILENAME.MP4' was already specified.

How do I see just the duration of a file from the Windows command prompt?

1 Answer 1


First, if you just want information about a file, you should probably use "ffprobe", not "ffmpeg". Otherwise you'll get an answer, but you'll also have an error return status.

As to your real question: By convention, ffmpeg reserves STDOUT for binary video and audio data only. Everything else, including all the possible kinds of informative text, is sent to STDERR.

So, try changing your code to:

ffprobe FILENAME.EXT 2| find "Duration:" (for a *nix shell)


ffprobe.exe FILENAME.EXT 2>&1 | findstr Duration (for a Windows shell)

  • Does not work. See revised question.
    – K7AAY
    Commented Aug 18, 2020 at 9:31
  • Improved it. Thank you
    – garryw
    Commented Aug 28, 2020 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.