News:

--

Main Menu

Any chance to keep subtitles in TS files?

Started by M-Reimer, August 08, 2016, 04:22:42 PM

Previous topic - Next topic

AQUAR

It would be nice to have such a feature but ultimately it is up to the contributors of this project to make it happen.
I believe the author has given an explanation at response 5 viz "it is not that easy".

Anyone that knows better though can always contribute to this open source project and make it happen.


sbarmen

#16
I would also love this feature as I use this alot with VideoReDo. +1 for this feature! :D

Sadly I have too little knowledge to make this happen myself...

Just on a sidenote VideoReDo does this prefectly, and personally I would be willing to pay some money to get this feature if it would be developed.

alexwilmac

I read this a bit old topic and I'd like to know if anyone is aware of any change in the future version of ADM.
Considered how many devices, especially the ones linux-based, use the .ts format with embedded subs, it would be great to have them preserved, as many other user have said ;)

eumagga0x2a

Whoever is interested in subtitle stream support getting added to all the required components (core libs, MpegTS demuxer, editor, at least the MpegTS and preferably MKV muxers), should contribute code or hire a professional developer to work on the project.

alexwilmac

About the alleged difficulties supposed in post#5, I'm also sceptical for a simple reason: if I cut my ts file by an enigma2 plugin, despite the plugin is not perfect at cutting (it has not keyframe capability, for instance) it perfectly manages the subtitles.
This is (probably) because, as jjddav says in post#10, they are embedded into the ts files.
That's why I can't understand why a simple plugin (that cuts in a few seconds a ts file of a couple of hours) is better at preserving subs than a great software like Avidemux is.

alexwilmac

Old topic but...
Avidemux is great, is really such a powerful software.
I (and many, many user who own a PVR and need to cut ts files preserving subtitles) are hoping an effort to make this software the state of the art.
Each time I download a new release, I hope (and pray) to get a surprise.

JDepp

Sorry for replying to this old thread...
I just wanted to add to the long list of users requesting this much looked for functionality - preserving the subtitles in the edited output files
Thanks

xyzzy

I think it might not be that hard to do this outside avidemux.

  • Extract subs with ffmpeg or aegisub.
  • Save avidemux video edits to avidemux project .py file.
  • Extract edit times from avidemux project, create an aegisub lau script to edit subtitles.
  • Re-mux edited subs into avidemux output file.

Everything is trivial except creating aegisub lua script.  Getting edit times from avidemux project is not hard.  There is a trick to turning avidemux timestamps into real PTS values.

I don't think it would be hard to add this to avidemux either.  One can avoid large problem of demuxing and remuxing subtitles from all the different containers and all the different subtitle formats.  ffmpeg already does this.  It is just one ffmpeg command to extract subtitles to srt/ass file.  So avidemux can read in srt/ass file (subtitle filter in avidemux already does this), perform edits on subtitle times, and then save to srt/ass file.  Everything else is just simple scriptable commands with software that already exists.

xyzzy

I thought of another way to get edited subs and it ended up being pretty easy to do.

Extract the subs in srt format from the source file(s) with ffmpeg
Save your avidemux edit as a project
Run my python script on the project file and it will assemble an edited srt file that can be added to avidemux's encoded output video with mkvmerge.

One can never get away with posting code in this forum and there are no attachments, so I put it on an avidemux2 branch on github, srt-edit-script.

Direct link to files, adm_edit_srt.py and fakeavidemux.py

butterw

#24
fakeavidemux class allows to extract the segment info from an Avidemux project with an external python script (much more powerful than TinyPy but requires Python installed).

#!/bin/env python3
import os.path
import sys
from fakeavidemux import Avidemux
'''usage: python external_script.py project.py'''

# Read in Avidemux Project, which will create an adm object that has the file and segment info
proj = open(sys.argv[1]).read()
exec(proj)

# adm.segments (list) is now available

xyzzy

Quote from: xyzzy on April 21, 2021, 12:55:02 AMExtract the subs in srt format from the source file(s) with ffmpeg

I enhanced the script so this isn't necessary anymore.  It will automatically use ffprobe and ffmpeg to extract subtitles or closed captions from the video file(s) if there aren't .srt files already.  One needs ffprobe and ffmpeg installed of course.