-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postprocess: add support to merge & remux to matroska (MKV) #1027
base: master
Are you sure you want to change the base?
Conversation
This commit adds support for postprocessing to the matroska format (MKV) using either mkvmerge or ffmpeg/avconv. This is activated with the new --output-format option or by specifin output_format: mkv in the config file. Code is still a work in progress and need to be cleaned up a bit, there might be some bugs left. It also change the way svtplay-dl detects if a file already exists on disk. If name of service and video_id is included in filename it will scan for that (just as before), if not it will just compare the filename without extension (excluding subtitles) (this might need some improvement)
When dealing with multiple subtitles, the singular video and audio tracks is added with each subtitle. This of course results in a multiplied file size which we don't want.
if ext == '.ts': | ||
logging.info('Changing bitstream for TS audio by muxing to MP4') | ||
self.remux_mp4() | ||
orig_filename = u"{0}.mp4".format(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we do .ts to .mp4 to .mkv? feels way to much. we cant go from .ts to .mkv directly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For newer ffmpeg versions we do not need to perform this step. I think it works with at least 3.0 and newer on windows. If you make a decision to not support older ffmpeg versions this step could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm i guess we should only support ffmpeg 3.2 or newer. debian stable have 3.2. ubuntu 18.04 (LTS) have 3.4. but ubuntu 16.04 ( Old LTS) have 2.8. they can run the script in docker or something if they want to use something newer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or they can use PPA:
Version ffmpeg 3.x:
https://launchpad.net/~jonathonf/+archive/ubuntu/ffmpeg-3
Version 4.x:
https://launchpad.net/~jonathonf/+archive/ubuntu/ffmpeg-4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But should you use ffmpeg below 4.x? I'm thinking of the TV4 issue with out of sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is the case, then just put a note in the readme or something that you shouldn't use older ffmpeg. Or just handle it (recommend/help them to update) when people complain.
Or just tell them to install mkvmerge and this will not be an issue anymore
cmd = [self.detect, "-i", orig_filename] | ||
if ext == '.ts': | ||
logging.info('Changing bitstream for TS audio by muxing to MP4 first') | ||
self.remux_mp4() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment about this..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we do this. we should use _clean_ts_audio instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we can use _clean_ts_audio for stuff like HLS files from viafree which have the video track and audio track in the same .ts file?
For merging when we have a seperate audio file it works fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I removed this for now, as it seemed to work with viafree .ts files without the remuxing step, and dplay will go through the merging function instead.
Is there any service which have ts audio that we need to change the bitstream for and provides the audio and video in a single .ts file?
This pull request adds support for postprocessing to the matroska format (MKV) as requested in #812
Support for muxing to MKV using either mkvmerge or ffmpeg/avconv. This is activated with the new --output-format option or by specifin output_format: mkv in the config file.
Code is still a work in progress and need to be cleaned up a bit, there might be some bugs left.
It also change the way svtplay-dl detects if a file already exists on disk.
If name of service and video_id is included in filename it will scan for that (just as before),
if not it will just compare the filename without extension (excluding subtitles) (this might need some improvement)