ffmpeg How to fix "Unable to parse option value "/subtitle.ass" as image size"
value "/project/temp/subtitle.ass" as image size That is wrong
value "D:/project/temp/subtitle.ass" as image size that is right
Here's my code
import subprocess from pathlib import Path ass_path = r'D:\project\temp\subtitle.ass'
cmd = [ 'ffmpeg', '-i', r'D:\pycharm_project\other\original_video.mp4', '-vf', f"ass={Path(ass_path).resolve().as_posix()}", '-c:v', 'libx264', '-crf', '18', '-c:a', 'copy', '-y', 'mmmmm.mp4' ] subprocess.run(cmd, check=True)
change the subtitle path to the following:
f"ass={Path(ass_path).resolve().as_posix()}".replace(':','\\\\:')
finally
import subprocess from pathlib import Path ass_path = r'D:\project\ffmpeg_demo\20251106155922.ass'
cmd = [ 'ffmpeg', '-i', r'D:\pycharm_project\other\original_video.mp4', '-vf', f"ass={Path(ass_path).resolve().as_posix()}".replace(':','\\\\:'), '-c:v', 'libx264', '-crf', '18', '-c:a', 'copy', '-y', 'mmmmm.mp4' ] subprocess.run(cmd, check=True)
Done.
Comments
Post a Comment