使用下面的腳本時,我得到Unknown argument: |
,我不確定它爲什麼不喜歡|
。我在Windows上,與Python 2.7.11:Python Popen - 未知參數:|
import subprocess
from subprocess import Popen, PIPE, STDOUT
import time
command = 'VSPipe.exe --y4m script.vpy - | ffmpeg.exe -f yuv4mpegpipe -i - -c:v prores -an output.mov'
process1 = Popen(command, stderr=PIPE, shell=False)
while True:
line = process1.stderr.readline().decode('utf-8')
print line
time.sleep(2)
UPDATE: 使用建議下面我現在已經嘗試過這一點,但我正在逐漸pipe:: Operation not permitted
。我究竟做錯了什麼?
import subprocess
from subprocess import Popen, PIPE, STDOUT
import time
command1 = 'VSPipe.exe --y4m script.vpy -'
command2 = 'ffmpeg.exe -f yuv4mpegpipe -i - -c:v prores -an output.mov'
process1 = Popen(command1, stdout=PIPE)
process2 = Popen(command2, stdin=process1.stdout, stderr=PIPE)
print process2.communicate()
另一個更新: 因此,使用下面的建議,並嘗試其他的東西,我一直得到相同的結果pipe:: Operation not permitted
。下面是完整的sdterr
,還有什麼我可以試試:
"F:/ffmpeg/VapourSynth/VSPipe.exe" --y4m "C:/Users/myself/Desktop/script.vpy" -
"F:/ffmpeg/ffmpeg.exe" -f yuv4mpegpipe -i - -c:v prores -an -y "//192.168.0.100/media/temp/OutMov.mov"
ffmpeg version N-77203-gb8e5b1d Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/Users/myself/Desktop/Download/ffmpeg-windows-build-helpers-master/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --disable-w32threads --enable-gpl --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-libvidstab --enable-libx265 --enable-decklink --extra-libs=-loleaut32 --enable-libx264 --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-libdcadec --enable-avisynth --enable-gray --enable-libopenh264 --extra-libs=-lpsapi --extra-cflags= --enable-static --disable-shared --prefix=/Users/myself/Desktop/Download/ffmpeg-windows-build-helpers-master/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-nonfree --enable-libfdk-aac --disable-libfaac --enable-nvenc --enable-runtime-cpudetect
libavutil 55. 10.100/55. 10.100
libavcodec 57. 17.100/57. 17.100
libavformat 57. 19.100/57. 19.100
libavdevice 57. 0.100/57. 0.100
libavfilter 6. 20.100/6. 20.100
libswscale 4. 0.100/4. 0.100
libswresample 2. 0.101/2. 0.101
libpostproc 54. 0.100/54. 0.100
pipe:: Operation not permitted
UPDATE: 而她是ffmpeg的報告:
F:/ffmpeg/ffmpeg.exe -f yuv4mpegpipe -i - -c:v prores -an -y //192.168.0.100/media/temp/OutMov.mov -report
ffmpeg version N-77203-gb8e5b1d Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/Users/myself/Desktop/Download/ffmpeg-windows-build-helpers-master/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --disable-w32threads --enable-gpl --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-libvidstab --enable-libx265 --enable-decklink --extra-libs=-loleaut32 --enable-libx264 --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-li libavutil 55. 10.100/55. 10.100
libavcodec 57. 17.100/57. 17.100
libavformat 57. 19.100/57. 19.100
libavdevice 57. 0.100/57. 0.100
libavfilter 6. 20.100/6. 20.100
libswscale 4. 0.100/4. 0.100
libswresample 2. 0.101/2. 0.101
libpostproc 54. 0.100/54. 0.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument 'yuv4mpegpipe'.
Reading option '-i' ... matched as input file with argument '-'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'prores'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '//192.168.0.100/media/temp/OutMov.mov' ... matched as output file.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file -.
Applying option f (force format) with argument yuv4mpegpipe.
Successfully parsed a group of options.
Opening an input file: -.
[AVIOContext @ 006d9800] Statistics: 0 bytes read, 0 seeks
pipe:: Operation not permitted
UPDATE: 使用此代碼,我仍然得到同樣的結果pipe:: Operation not permitted
:
import subprocess
import os
from subprocess import Popen, PIPE, STDOUT
import shlex
VsPipe = 'F:/ffmpeg/VapourSynth/VSPipe.exe'
vpyScript = 'C:/Users/myself/Desktop/Boychoir-preview_SMALL_JobID_189.vpy'
ffmpeg = 'F:/ffmpeg/ffmpeg.exe'
outputPath = '//192.168.0.100/media/temp/OutMov.mov'
command1 = shlex.split('"%s" --y4m "%s" - ' % (VsPipe, vpyScript))
command2 = shlex.split('"%s" -f yuv4mpegpipe -i - -c:v prores -an -y "%s" -report' % (ffmpeg, outputPath))
process1 = subprocess.Popen(command1, stdout=subprocess.PIPE)
ls_out, _ = process1.communicate()
process2 = subprocess.Popen(command2, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
grep_out, grep_err = process2.communicate(input=ls_out)
print grep_err
UPDATE: 固定的,竟然是一個文件路徑權限問題,謝謝FO所有的幫助。
不能使用 '|'在命令一起管道命令參考http://stackoverflow.com/questions/7389662/link-several-popen-commands-with-pipes。 –
發現這個http://stackoverflow.com/questions/9356960/ffmpeg-operation-not-permitted-error-while-conversion –
似乎沒有關係,但無論如何感謝。 – speedyrazor