0

I need the output of my ffprobe command. so I used subprocess module as follow:

lengthofvideo = subprocess.check_output('ffprobe', '-i' %inputfile, '-show_entries', 'format=duration', '-v', 'quiet', '-of', 'csv="p=0"')

input file variable contains the full bash-like path to video. But my syntax has an error and I got the following error:

TypeError: not all arguments converted during string formatting

Any help is appreciated.

Mahdi
  • 967
  • 4
  • 18
  • 34

1 Answers1

0

The easiest way that I do that was to create a command and then pass it to the subprocess:

cmd = 'ffprobe -i ' + inputfile + ' -show_entries format=duration -v quiet -of csv="p=0"'
lengthofvideo = subprocess.check_output(cmd, shell=True)
Mahdi
  • 967
  • 4
  • 18
  • 34