简体   繁体   中英

How to start ffprobe with Windows PowerShell

I am using Zeranoes FFmpeg Builds for Windows and I can start the ff-prompt without installing anything. But how do I start ff-prompt.bat with Windows PowerShell? I have tried a few things like Invoke-Expression or changing the $env:Path but nothing seems to work, because all I get is the message

"C:\\Users\\Administrator>ECHO OFF

bin\\ffmpeg.exe could not be found."

Is it even possible to start ff-prompt with PowerShell? Every suggestion / solution is more than welcome.

My goal is to have a solution that works like this here: http://spreadys.wordpress.com/2012/12/03/ffprobe-and-windows-powershell/

but I want to do that automatically for all my clips, thats why I need to start ffprobe with powershell.


ECHO OFF
REM FF Prompt 1.1
REM Open a command prompt to run ffmpeg/ffplay/ffprobe
REM Copyright (C) 2013  Kyle Schwarz

TITLE FF Prompt

IF NOT EXIST bin\ffmpeg.exe (
  CLS
  ECHO bin\ffmpeg.exe could not be found.
  GOTO:error
)

CD bin || GOTO:error
PROMPT $G
CLS
ffmpeg -version
SET PATH=%CD%;%PATH%
ECHO.
ECHO For help run: ffmpeg -h
ECHO For formats run: ffmpeg -formats ^| more
ECHO For codecs run: ffmpeg -codecs ^| more
ECHO.
ECHO Current directory is now: "%CD%"
ECHO The bin directory has been added to PATH
ECHO.

CMD /F:ON /Q /K
GOTO:EOF

:error
  ECHO.
  ECHO Press any key to exit.
  PAUSE >nul
  GOTO:EOF

Okay I tried something a little bit different this time:

$env:Path = ';C:\Users\Administrator\bin\'
$title = "A_Day_for_Cake_and_Accidents"
Start-Process ff-prompt.bat -ArgumentList "ffprobe -show_streams -select_streams v -print_format xml -count_frames C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\$title.mov > C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\totalframes.xml"

This creates a file called "totalframes.xml" but without the needed information, the only thing I get is:

C:\\Users\\Administrator>ECHO OFF ffmpeg version N-60959-g669043d built on Feb 27 2014 22:01:58 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 66.100 / 52. 66.100 libavcodec 55. 52.102 / 55. 52.102 libavformat 55. 33.100 / 55. 33.100 libavdevice 55. 10.100 / 55. 10.100 libavfilter 4. 2.100 / 4. 2.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100 For help run: ffmpeg -h For formats run: ffmpeg -formats | more For codecs run: ffmpeg -codecs | more Current directory is now: "C:\\Users\\Administrator\\bin" The bin directory has been added to PATH

So basically the console pops up, writes this standard text and does not use my commands which I stated in -Argument-List . I do not have a clue why it is ignoring most of my commands, except for writing everything in a XML file.

根据我在SVN存储库中找到的ff-prompt.bat以及您的不同评论,您应该位于C:\\Users\\Administrator\\ffmpeg目录中才能启动此.bat文件。

You can launch ff-prompt.bat from PowerShell as follows. Firstly, set the working directory to that which contains ff-prompt.bat eg c:\\users\\administrator\\ffmpeg. Secondly, type the following and press enter: .\\ff-prompt.bat . I tested this with file set downloaded from Zeranoe and the CMD session opened and displayed as follows:

ffmpeg version N-61143-g64e4bd7
built on Mar  7 2014 00:01:08 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig
--enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore
-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspee
x --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libv
orbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-z
lib
libavutil      52. 66.101 / 52. 66.101
libavcodec     55. 52.102 / 55. 52.102
libavformat    55. 33.101 / 55. 33.101
libavdevice    55. 11.100 / 55. 11.100
libavfilter     4.  3.100 /  4.  3.100
libswscale      2.  5.101 /  2.  5.101
libswresample   0. 18.100 /  0. 18.100
libpostproc    52.  3.100 / 52.  3.100

For help run: ffmpeg -h
For formats run: ffmpeg -formats | more
For codecs run: ffmpeg -codecs | more

Current directory is now: "C:\Users\Andy\Downloads\ffmpeg-20140307-git-64e4bd7-win32-static\ffmpeg-20140307-git-64e4bd7-
win32-static\bin"
The bin directory has been added to PATH

>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM