简体   繁体   中英

the output of subprocess is different from the ffprob outptu

I am trying the find the bitrate of each video and for this I used the following python command:

subprocess.call(['ffprobe', '-i',pname1,'-v', 'quiet', '-show_entries', 'format=bit_rate', '-hide_banner', '-of', 'default=noprint_wrappers=1:nokey=1'])

pname1 is the name of the file. but the output is zero for all files while when I used the same code in the shell the output is true and shows the true value for bitrate.

ffprobe -i 1.mkv -v quiet -show_entries format=bit_rate -hide_banner -of default=noprint_wrappers=1:nokey=1

do you know what is the problem?

You get the return value of call() method and that is 0 which is succesfull. To get bitrate value as output, you can use subprocess.check_output()

output=subprocess.check_output(['ffprobe', '-i',pname1,'-v', 'quiet', '-show_entries', 'format=bit_rate', '-hide_banner', '-of', 'default=noprint_wrappers=1:nokey=1'])

print(output)

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