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

  • Home
  • SEARCH
  • 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 518103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:54:10+00:00 2026-05-13T07:54:10+00:00

Im trying to automate video conversion with powershell and ffmpeg tool. Ffmpeg have detailed

  • 0

Im trying to automate video conversion with powershell and ffmpeg tool.
Ffmpeg have detailed output about video if called without all nessesary parameters. Usually it reports about error and display input file info if one specified.
Ex I interactively executed such command:

d:\video.Enc\ffmpeg.exe -i d:\video.Enc\1.wmv

this is powershell console output

ffmpeg.exe : FFmpeg version SVN-r20428, Copyright (c) 2000-2009 Fabrice Bellard, et al.
row:1 char:24
+ d:\video.Enc\ffmpeg.exe <<<<  -i d:\video.Enc\1.wmv
    + CategoryInfo          : NotSpecified: (FFmpeg version ...Bel 
   lard, et al.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

  built on Nov  1 2009 04:03:50 with gcc 4.2.4
  configuration: --enable-memalign-hack --prefix=/mingw --cross-pre
fix=i686-mingw32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 
--arch=i686 --cpu=i686 --enable-avisynth --enable-gpl --enable-vers
ion3 --enable-zlib --enable-bzlib --enable-libgsm --enable-libfaad 
--enable-pthreads --enable-libvorbis --enable-libtheora --enable-li
bspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --
enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb 
--enable-libopencore_amrnb
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.37. 1 / 52.37. 1
  libavformat   52.39. 2 / 52.39. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
[wmv3 @ 0x144dc00]Extra data: 8 bits left, value: 0

Seems stream 1 codec frame rate differs from container frame rate: 
1000.00 (1000/1) -> 15.00 (15/1)
Input #0, asf, from 'd:\video.Enc\1.wmv':
  Duration: 00:12:0
2.00, start: 5.000000, bitrate: 197 kb/s
    Stream #0.0(eng): Audio: wmav2, 44100 Hz, 1 channels, s16, 48 k
b/s
    Stream #0.1(eng): Video: wmv3, yuv420p, 1024x768, 137 kb/s, 15 tbr, 1k tbn, 1k tbc Metadata
    title           : Silverlight 2.0 Hello World Application
    author          : Sergey Pugachev
    copyright       : 
    comment         : 
    WMFSDKVersion   : 11.0.6001.7000
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 1
    ASFLeakyBucketPairs: 
    VBR Peak        : 715351
    Buffer Average  : 127036
At least one output file must be specified

But I cant figure how to script this and capture output to any kind of posh objects.
I tried direct script, wher ps1 file contained exact expression “d:\video.Enc\ffmpeg.exe -i d:\video.Enc\1.wmv” – it didnt work. Also i tried to do that with invoke-command and invoke expression. First one returns an exact string with command, second one – dump error to output console but not to -ErrorVariable i specified ( I did set all out variables, not only error one – all of them were empty).

Can anyone point to correct syntax for invoking console applications in posh and capturing output ?

Second one question will be about parsing that output – I’ll need video resolution data to calculate correct aspect ratio for conversion. So it will be cool if anyone point how to work with captured error output and parse string like

Stream #0.1(eng): Video: wmv3, yuv420p, 1024×768,

  • 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-13T07:54:10+00:00Added an answer on May 13, 2026 at 7:54 am

    Try redirecting the error stream to stdout like so and then you should be able to capture both stdout and stderr in a single variable e.g.:

    $res = d:\video.Enc\ffmpeg.exe -i d:\video.Enc\1.wmv 2>&1
    

    To capture the data try this:

    $res | Select-String '(?ims)^Stream.*?(\d{3,4}x\d{3,4})' -all | 
        %{$_.matches} | %{$_.Groups[1].Value}
    

    I’m not sure if $res will be one string or multiple but the above should work for both cases.

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

Sidebar

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.