WIP add check if duration is set/valid

This commit is contained in:
RealStickman 2022-12-16 14:51:10 +01:00
parent c45861d766
commit 5e4196a2c7

26
main.py
View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# ffmpeg wrapper # ffmpeg wrapper
import subprocess
import ffmpy import ffmpy
# argument parsing # argument parsing
@ -182,3 +183,28 @@ if execute:
ff.run() ff.run()
else: else:
print(ff.cmd) print(ff.cmd)
# NOTE check all files for an intact/valid duration
# Valid file example output:
# {
# "format": {
# "duration": "1425.058000"
# }
# }
# Invalid file:
# {
# "format": {
#
# }
# }
ff = ffmpy.FFprobe(
inputs={outputfile: None},
global_options=("-show_entries format=duration -v quiet -print_format json"),
)
proc = subprocess.Popen(
ff.cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True
)
# TODO continue here
print(proc.stdout.read().rstrip().decode("utf8"))