Python Forum
How to 'soft-embedd' subtitles with python-ffmpeg
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to 'soft-embedd' subtitles with python-ffmpeg
#1
Hello,

I've found an example on how to embed subtitles using ffmpeg from command line:
ffmpeg -i video.mp4 -i subtitles.srt -map 0:v -map 0:a -c copy -map 1 -c:s:0 mov_text -metadata:s:s:0 language=fra output.mp4

This way subtitles are embedded as metadata ... quite rapid process.

Because I need to embed subtitles in multiple files I searched a solution that uses Python.
Indeed such a solution exist: ffmpeg-python 0.2.0

But I didn't find example how embed subtitles as metadata, i.e not burn them in video.
The only example on embedding subtitles I've found is here:

import ffmpeg
input_dir = 'mydir/'
video_file = 'video.mp4'
subtl_file = 'subtitles.srt'

(
    ffmpeg
    .input(input_dir+video_file)
    .filter('subtitles', input_dir+subtl_file)
    .output(input_dir+'output.mp4')
    .run()
)
But this way subtitles are burned into video ... quite time-consuming process.

Any suggestions ?

Thanks.
Reply


Messages In This Thread
How to 'soft-embedd' subtitles with python-ffmpeg - by Pavel_47 - Jul-04-2022, 11:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Merge video with subtitles Pavel_47 26 7,081 Jul-06-2022, 02:27 PM
Last Post: Pavel_47
  Python Flask Realtime system printout (console) ffmpeg jttolleson 3 3,089 Apr-18-2022, 06:39 PM
Last Post: jttolleson
  MovieWriter ffmpeg unavailable; using Pillow instead. Joni_Engr 1 30,538 Aug-13-2021, 03:39 PM
Last Post: deanhystad
  [split] Launch soft on Terminal in silent mode Note3409 2 2,129 Oct-03-2020, 08:21 PM
Last Post: Note3409
  When piping a FFMPEG stream to PyAudio, I get a "click" on every loop klehman 0 4,946 Dec-15-2019, 04:22 AM
Last Post: klehman
  how do you use stupid ffmpeg ineedastupidusername 0 4,431 Nov-10-2017, 05:38 AM
Last Post: ineedastupidusername

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020