I'm trying to capture the output from ffprobe. First, I build my command:
>>> print cmd
['C:\\Program Files\\ffmpeg\\bin\\ffprobe.exe', 'somefile.mov']
Then I use check_output to grab the output:
>>> import subprocess as sp
>>> output = sp.check_output(cmd)
ffprobe version N-66673-gf0d1b3a Copyright (c) 2007-2014 the FFmpeg developers
built on Oct 6 2014 22:10:42 with gcc 4.9.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 54. 9.100 / 54. 9.100
libavcodec 56. 3.101 / 56. 3.101
libavformat 56. 7.104 / 56. 7.104
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.102 / 5. 1.102
libswscale 3. 1.100 / 3. 1.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 1.100 / 53. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'somefile.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf56.7.104
Duration: 00:20:54.46, start: 0.000000, bitrate: 1734 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 1617 kb/s, 24 fps, 24 tbr, 1
2288 tbn, 24576 tbc (default)
Metadata:
handler_name : DataHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 113 kb/s (default)
Metadata:
handler_name : DataHandler
However when I print the output, I get nothing:
>>> print output
I got the same result with Popen and communicate():
>>> output = sp.Popen(cmd, stdout=sp.PIPE)
>>> output.communicate()
('', None)
Well, I guess it's not really nothing. Looks like I got a blank string back?