summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2026-08-08 20:00:33 -0500
committerHunter Kvalevog <hunter@kvog.sh>2026-08-08 20:00:33 -0500
commit217e66fa192ddd08348cd2b8930153ebf7e70db8 (patch)
treee94797f324fbcec7b3c802cf757e4ea0933818cf /bin
parent5e6f58423de9e01cde8d7de056b5b3d7b16738f4 (diff)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ffmpeg-embed-cmd14
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/ffmpeg-embed-cmd b/bin/ffmpeg-embed-cmd
index 83b6c1e..6950003 100755
--- a/bin/ffmpeg-embed-cmd
+++ b/bin/ffmpeg-embed-cmd
@@ -1,16 +1,26 @@
#!/usr/bin/env python3
+import os
+import shlex
import subprocess
import sys
if __name__ == '__main__':
ffmpeg_cli = ['ffmpeg'] + sys.argv[1:]
+
if len(ffmpeg_cli) > 1:
ffmpeg_ver = subprocess.run(['ffmpeg', '-version'], capture_output=True, text=True)
ffmpeg_ver = ffmpeg_ver.stdout.splitlines()[0]
- ffmpeg_str = ' '.join(ffmpeg_cli)
+ ffmpeg_str = ' '.join(shlex.quote(arg) for arg in ffmpeg_cli)
ffmpeg_cli[-1:-1] = [
'-metadata', f'FFMPEG_VER={ffmpeg_ver}',
'-metadata', f'FFMPEG_CMD={ffmpeg_str}',
]
- subprocess.run(ffmpeg_cli)
+
+ out_path = ffmpeg_cli[-1]
+ out_dir = os.path.dirname(out_path)
+ if out_dir:
+ os.makedirs(out_dir, exist_ok=True)
+
+ result = subprocess.run(ffmpeg_cli)
+ sys.exit(result.returncode)