forked from localhorst/media_management_scripts
Compare commits
1 Commits
allow-whit
...
webm-suppo
Author | SHA1 | Date | |
---|---|---|---|
4a93c1f9db
|
@ -25,7 +25,7 @@ class MediaFile:
|
|||||||
duration: int #in sec
|
duration: int #in sec
|
||||||
|
|
||||||
def supported_file_extension(filename):
|
def supported_file_extension(filename):
|
||||||
if filename.endswith('.mp4') or filename.endswith('.mkv'):
|
if filename.endswith('.mp4') or filename.endswith('.mkv') or filename.endswith('.webm'):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import PIL
|
import PIL
|
||||||
@ -49,10 +50,9 @@ def get_codec(filename):
|
|||||||
return str(result.stdout.decode("utf-8")).rstrip("\n")
|
return str(result.stdout.decode("utf-8")).rstrip("\n")
|
||||||
|
|
||||||
def extract_frame(video_file, time_offset, output_file):
|
def extract_frame(video_file, time_offset, output_file):
|
||||||
cmd = ["ffmpeg", "-y", "-ss", time.strftime('%H:%M:%S', time.gmtime(time_offset)) + ".00",
|
cmd = "ffmpeg -y -ss " + time.strftime('%H:%M:%S', time.gmtime(time_offset)) + ".00 -i " + str(video_file) + " -frames:v 1 " + str(output_file)
|
||||||
"-i", str(video_file), "-frames:v", "1", str(output_file)]
|
|
||||||
devnull = open(os.devnull, 'w')
|
devnull = open(os.devnull, 'w')
|
||||||
subprocess.call(cmd, stdout=devnull, stderr=devnull)
|
subprocess.call(shlex.split(cmd),stdout=devnull, stderr=devnull)
|
||||||
|
|
||||||
def get_font_path():
|
def get_font_path():
|
||||||
path = "/usr/share/fonts"
|
path = "/usr/share/fonts"
|
||||||
|
Reference in New Issue
Block a user