Try to execute ffmpeg in python – subtitles error


This Content is from Stack Overflow. Question asked by user103162

I try to exectute :
./ffmpeg.exe -i “video.mkv” -vf subtitles=”video.mkv” “video.mp4”
This command works fine

But not in my python code

from pathlib import Path
import subprocess
import os

ffmpeg = r"D:Archivesffmpeg.exe"
videos = Path(".")

for file_mkv in videos.glob("*.mkv"):
    file_mp4 = file_mkv.with_suffix(".mp4")[ffmpeg, "-i", file_mkv, "-vf", f'subtitles="{file_mkv}"', file_mp4])

Error :
[Parsed_subtitles_0 @ 0000020cb26222c0] Unable to open “video.mkv”
[AVFilterGraph @ 0000020cb715a380] Error initializing filter ‘subtitles’ with args ‘”video.mkv”‘
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?