Git Product home page Git Product logo

justdan96 / tsmuxer Goto Github PK

View Code? Open in Web Editor NEW
823.0 38.0 141.0 3.63 MB

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.

License: Apache License 2.0

C++ 92.74% C 1.13% CMake 0.52% Shell 0.77% QMake 0.09% HTML 4.71% Batchfile 0.04%

tsmuxer's Introduction

tsMuxer

Vision

This project is for tsMuxer - a transport stream muxer for remuxing/muxing elementary streams. This is very useful for transcoding and this project is used in other products such as Universal Media Server.

EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS.

Supported video codecs H.264/AVC, H.265/HEVC, H.266/VVC (Alpha release), VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD - please note TrueHD must have the AC3 core intact.

Some of the major features include:

  • Ability to set muxing fps manually and automatically
  • Ability to change level for H.264 streams
  • Ability to shift a sound tracks
  • Ability to extract DTS core from DTS-HD
  • Ability to join files
  • Output/Author to compliant Blu-ray Disc or AVCHD
  • Blu-ray 3D support

Ethics

This project operates under the W3C's Code of Ethics and Professional Conduct:

W3C is a growing and global community where participants choose to work together, and in that process experience differences in language, location, nationality, and experience. In such a diverse environment, misunderstandings and disagreements happen, which in most cases can be resolved informally. In rare cases, however, behavior can intimidate, harass, or otherwise disrupt one or more people in the community, which W3C will not tolerate.

A Code of Ethics and Professional Conduct is useful to define accepted and acceptable behaviors and to promote high standards of professional practice. It also provides a benchmark for self evaluation and acts as a vehicle for better identity of the organization.

We hope that our community group act according to these guidelines, and that participants hold each other to these high standards. If you have any questions or are worried that the code isn't being followed, please contact the owner of the repository.

Language

tsMuxer is written in C++. It can be compiled for Windows, Linux and Mac.

History

This project was created by Roman Vasilenko, with the last public release 20th January 2014. It was open sourced on 23rd July 2019, to aid the future development.

Installation

Please see INSTALLATION.md for installation instructions.

Usage

Please see USAGE.md for usage instructions.

Todo

The following is a list of changes that will need to be made to the original source code and project in general:

  • the program doesn't support MPEG-4 ASP, even though MPEG-4 ASP is defined in the TS specification
  • no Opus audio support
  • has issues with 24-bit DTS Express
  • issues with the 3D plane lists when there are mismatches between the MPLS and M2TS

Contributing

We’re really happy to accept contributions from the community, that’s the main reason why we open-sourced it! There are many ways to contribute, even if you’re not a technical person.

We’re using the infamous simplified Github workflow to accept modifications (even internally), basically you’ll have to:

  • create an issue related to the problem you want to fix (good for traceability and cross-reference)
  • fork the repository
  • create a branch (optionally with the reference to the issue in the name)
  • hack hack hack
  • commit incrementally with readable and detailed commit messages
  • submit a pull-request against the master branch of this repository

We’ll take care of tagging your issue with the appropriated labels and answer within a week (hopefully less!) to the problem you encounter.

If you’re not familiar with open-source workflows or our set of technologies, do not hesitate to ask for help! We can mentor you or propose good first bugs (as labeled in our issues). Also welcome to add your name to Credits section of this document.

All pull requests must pass code style checks which are executed with clang-format version 9. Therefore, it is advised to install an appropriate commit hook (for example this one) to your local repository in order to commit properly formatted code right away.

Submitting Bugs

You can report issues directly on Github, that would be a really useful contribution given that we lack some user testing on the project. Please document as much as possible the steps to reproduce your problem (even better with screenshots).

Building

For full details on building tsMuxer for your platform please see the document on COMPILING.

Testing

The very rough and incomplete testing document is available at TESTING.md.

Financing

We are not currently accepting any kind of donations and we do not have a bounty program.

Sponsorships

The project is part of the MacStadium Open Source Program to create native Apple Silicon executables for Mac OS.

MacStadiumOpenSource

Versioning

Version numbering follows the Semantic versioning approach.

License

We’re using the Apache 2.0 license for simplicity and flexibility. You are free to use it in your own project.

Credits

Original Author Roman Vasilenko (physic)

Contributors

  • Daniel Bryant (justdan96)
  • Daniel Kozar (xavery)
  • Jean Christophe De Ryck (jcdr428)
  • Stephen Hutchinson (qyot27)
  • Koka Abakum (abakum)
  • Alexey Shidlovsky (alexls74)
  • Lonely Crane (lonecrane)
  • Markus Feist (markusfeist)

For sake of brevity I am including anyone who has merged a pull request!

tsmuxer's People

Contributors

abakum avatar alexls74 avatar aug5t7 avatar chadady avatar cubicibo avatar drakegalley avatar drecksoft avatar frtranslator avatar gothicvi avatar hobbes1069 avatar i6henl avatar iwashiira avatar jcdr428 avatar jp3bgy avatar justdan96 avatar lonecrane avatar markusfeist avatar mm47608740 avatar moveman avatar nu774 avatar quietvoid avatar qyot27 avatar stanionascu avatar theflash2k avatar xavery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tsmuxer's Issues

Correctly Handle FPS Detection

Can be tested using the following file:
https://mega.nz/#!NAtw1RqK!uQF9Uqn33KUCwe5fG66ojAJAkOv1bPNhKkcHQTSuceQ

It is a HEVC file, 2160p, 60 FPS, AAC audio. The FPS isn't detected correctly and 60FPS isn't an option in the "change framerate" drop-down.

tsMuxerGUI-60FPS

Attempting to mux anyway will result in the following output:

tsMuxeR version 2.6.15. github.com/justdan96/tsMuxer
This HEVC stream doesn't contain fps value. Muxing fps is absent too. Set muxing FPS to default 25.0 value.
HEVC stream doesn't contain fps field. Muxing fps=25
Decoding AAC stream (track 2): Sample Rate: 48KHz  Channels: 6
B-pyramid level 1 detected. Shift DTS to 2 frames
Processed 9843 video frames
Flushing write buffer
Mux successful complete
Muxing time: 2 sec

This appears to not just be affecting 60FPS files, will do some more testing.

[Bug] BD Transport stream bitrate is not limited

As per BD-Rom Part 3 Standards, the maximum reading rate of the BDAV MPEG-2 Transport Stream is 48Mbps for HD, 109 mbps for default UHD (cf. http://www.hughsnews.ca/faqs/authoritative-blu-ray-disc-bd-faq/8-recording-and-reading-speed)

This means that the minimum timegap between BD M2TS packets Arrival Time Stamps should be 846 for HD, 373 for UHD (base on PCR 27 Mhz). When the overall streams bitrate goes above this reading rate, the TS "smoothing buffer" absorbs the overflow.

tsMuxer does not limit the ATS timegap between packets to 846/373 for BD.

First MPLS / M2TS and Chapters

I use the w64-nightly-2020-01-02--01-10-53 and have this errors When use "UHD Blu-ray folder":

  • First MPLS dont respect the option after remux.
  • First M2TS dont respect the option after remux.
  • Chapters dont respect the list, put only "00:00:00.000" after remux.

warning: dynamic exception specifications are deprecated in C++11

Users trying to compile the code we see a lot of these warnings pop up:

../libmediation/fs/file.h:63:43: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   unsigned int systemDependentFlags = 0 ) throw ( std::runtime_error );

These warnings can be turned off for this one library - but the preferred fix is to resolve this error.

Caveated at the moment that we will look to completely replace libmediation in the future.

Russian comments inside the source code

Some of the files inside the source tree have comments in Russian. Those are mostly found around libmediation (almost every header file), but not exclusively (abstractStreamReader.h).
I know Russian well enough to try and translate these comments, but if there are any parts of the code which are going to be eradicated, I'd like to know about this in order not to waste effort needlessly.

Settings saving doesn't work

Hello,
I tried disable sound after end in general setting tab and change settings in subtitles and after exit tsmuxer don't remember this settings. This is normal?

manjaro and tsmuxer latest build git version.

Ubuntu i386 libraries

Ubuntu (well, I suppose Debian) provides the ability to do this automatically, without having to download a tarball. It should be a matter of simply:

sudo dpkg --add-architecture i386

Even if the exact step might change in future versions due to the shakeups with i386 support.

Muxing m2ts with SRT file error

When adding srt track on .m2ts file (HEVC 2160p HDR, AC3) it produces the following error.
Using Windows 10

When removing the Srt from input files it is ok.

image

tsMuxeR not found!

Hello,
I have problem when I want to add input file I received error:

Manjaro repo arch
N60xHu1

TsMuxer enable 50fps

I'm using TsMuxer and want to add native 50 fps to Change fps It is available 24, 25, 30

Enhancement: ability to select multiangle tracks

When selecting a multiangled mpls, tsMuxer currently automatically selects the default tracks i.e. no possibility to select alternative angles.

tsMuxer should detect whether the selected mpls is multiangled, in which case the GUI (resp. the CLI) will offer the user the possibility of selecting an angle e.g. with a dropdown list (resp. "--angle=") parameter.

Incorrect I_end values in ClipInf CPI EP Entries with UHD

tsPacket.cpp lines 965-980 define the threshold values for I-frame size to increment I_end.
These values seem to be extracted from the Blu-ray patents (eg US 2009/0016703 A1).

Until the threshold values for Transfer Rate > 60000000 (ie for UHD Blu-ray) are known, the I_end values above 1 recorded in the ClipInf CPI EP Entries are likely to be incorrect.

Code is not 64-bit clean

A 64-bit build of tsMuxeR currently creates corrupt but still playable output. For example, the audio and/or video will have glitches. The issue appears to be in the demuxing code rather than the muxing code, as the output is correct if tsMuxeR is given raw elementary streams (eg. .h264, .ac3, .wav files). Additionally, subtitle rendering does not work at all on 64-bit builds. I have determined that this is due to a failure to convert the name of the font to UTF-32, only the first character is converted. I have not determined why the string fails to convert.

Failure to find: debug/tsMuxerGUI_resource_res.o

# generate the tsMuxerGUI makefile
export PATH=$PATH:/mingw32/qt5-static/bin
cd ..
cd tsMuxerGUI
qmake

$ qmake
WARNING: Failure to find: debug/tsMuxerGUI_resource_res.o
WARNING: Failure to find: release/tsMuxerGUI_resource_res.o

Fehlermeldung - Can´t create temporary meta file ...

Hallo,
wenn ich eine Videodatei mit tsMuxeR 2.6.15 bearbeiten möchte, bekomme ich immer bei "Start muxing" die Fehlermeldung - Can´t create temporary meta file "C:\Users\Ronny_Weber\AppData\Local\Temp\tsMuxeR_VTS_01_1.meta".
Als Betriebssystem verwende ich Windows7 Professional 64bit.
Unter tsMuxeR 2.6.12 funktioniert alles ohne Fehlermeldung. Was mache ich falsch?
Vielen Dank für die Hilfe!

tsmuxer 2 6 15

C++14 support

What's holding the project back from requiring C++14 support?
All the recommended compilers in README.md support it :

  • The default GCC version in Debian 10 is 8.3.0, which even supports C++17.
  • Ubuntu 19.04 also ships GCC 8.3.0.
  • MSYS2 has shipped GCC 9.1.0 since 4th of July this year, with the previous major version being 7.3.0, which also supported C++17.
  • MSVC 2017 15.0 (so, the first public release) supports all C++14 features.

The lowest common denominator thus seems to be C++14.

Cannot handle AAC frame size above 2048

Reported by a5180007 here: https://forum.doom9.org/showthread.php?p=1890608#post1890608

Another bug for aac muxing. In brief, the aac frame size is written on 13 bits (bits 31-43 in the frame), however tsMuxeR takes into account only the first 11 bits. So when the aac frame size is above 2048 bytes, tsMuxeR incorrectly reports a bad frame and discards it.

In aac.cpp, replace line 52:

int AACCodec::getFrameSize(uint8_t* buffer)
{
	return buffer[4]*8 + (buffer[5] >> 5);
}

with

int AACCodec::getFrameSize(uint8_t* buffer)
{
	return ((buffer[3] & 0x03) << 11) + (buffer[4] << 3) + (buffer[5] >> 5);
}

Any 5.1 channel AAC audio should trigger the bug. (File shared privately, public example to be released soon!)

Synchronisation Issues with UHD HEVC

From a5180007 here: https://forum.doom9.org/showthread.php?p=1888650#post1888650

There is a bug creating unsynchronized AV with some HEVC files, due to insufficient size of coded picture buffer.
In brief, when reading a nal the end of the buffer is reached before finding the next nal start_code, and the PTS is not incremented for this nal.

I have corrected the bug on my side by simply changing the line 7 in avPacket.h from:

const static int MAX_AV_PACKET_SIZE = 32768;

to

const static int MAX_AV_PACKET_SIZE = 800000;

For testing the issue HEVC from https://uhdsample.com are a good choice. I've tried "Samsung 7 Wonders Of The World UHD 4k Sample 60 fps", with tsMuxer 2.6.12 it muxes 13,303 frames, and by increasing max frame size to 800,000 it muxes 13,773 frames: 470 HEVC frames (nearly five seconds) had been discarded by 2.6.12. You might have not seen it as nobody speaks in the video so it it difficult to spot audio delay.

However this video really has 13823 frames, so there are still 50 frames missing : the video is not bluray compliant, the frames are single slice (i.e. not split in four slices) and the biggest frame size in the video is 1,565,299 bytes (frame 7,106), which shows that increasing max frame size to 800,000 is not enough for non blu-ray compliant UHD. As stated previously, the permanent fix should be to rewrite code to get rid of max frame limitation.

Code Coverage Report

This potentially could be put into a GitHub action, but I thought I would create a couple of code coverage reports. One is using CCCC, the other Clang's scan-build. I'm hoping this will prove useful in future code clean-ups.

tsMuxer-code-coverage.zip

Bug: tsMuxer does not order 3D-Planes as per original MPLS

Cf. https://forum.doom9.org/showthread.php?p=1881372#post1881372 and https://forum.doom9.org/showthread.php?p=1882670#post1882670 :

"The other important bug with the subtitles is also related to the 3D BD. The MPLS file contains the extensions with the 3D-specific information, like what tsMuxeR calls the "3D-Planes", in fact the "Offset Sequences" necessary to display the subtitles at the correct depth on screen. There is usually one 3D-Plane per subtitle stream, although it's not mandatory as the same 3D-Plane can be used for several streams. The bug is that tsMuxeR assumes that the 3D-Planes are assigned to the subtitles streams in the order of their UID. It's not correct. The MPLS file describes precisely the subtitle streams, ans they do not have to be in the order of their UID, although it's often the case.

So, for example, if there are 4 subtitle streams in the BD, stored in the MPLS in the standard order, tsMuxeR will assign the 4 first 3D-Planes to that 4 streams, and it will probably be correct. But if the 4 streams are presented in the MPLS in another order, it will be wrong. And if the same 3D-Plane is assigned to several subtitle streams in the MPLS, it will assign it only once, and the last subtitle streams will not have any 3D-Plane at all. To summarize, tsMuxeR ignores the content of the MPLS when it assigns the 3D-Planes to the subtitle streams. That's an important bug, although the wrong information is only displayed, and never used during the demux operation. I don't know if tsMuxeR does the same error when it remuxes a 3D-BD, but I suppose so. "

tsMuxeR not found error

with lastest "w32-nightly-2019-12-14--14-44-59" build give me "tsMuxeR not found!" error and I have the "tsMuxeR.exe" and "tsMuxerGUI.exe" in the same folder.

Introduce Windows 32-bit Option

I initially didn't consider it useful to have 32-bit versions of tsMuxer, but as pointed out on the Doom9 forums there are still some users that require a 32-bit version of Windows (usually due to restrictions on hardware).

To resolve these issues I'll add a new CMake option to build 32-bit binaries for Windows.

Enhancement: Support converting BD folder to ISO ?

I found no way to do this, as the input must be a file. Is the resulting ISO even Bluray compliant ? ( UDF 2.50 ). If not, then I guess it would be a good feature request, because I found no way to make iso images from bluray folders and I have to use a windows vm with imgburn for this, which is not cool.

Enhancement: Add option to make a specific audio the default track and a specific subtitle track a forced track

Cf. https://forum.doom9.org/showthread.php?p=1895226#post1895226 :
`Actually, you can do it yourself in any HEX editor. Open MovieObject.bdmv, find 42 82 00 00 00 00 00 00 00 00 00 0A and insert next digits BEFORE 42 82 00 00 00 00 00 00 00 00 00 0A:

51 C0 00 01 80 01 C0 01 00 00 00 00
where:
1 - number of default audio track
1 - number of default subtitle track
C - all elements in selected PGS are shown. If you need to show only elements that marked with Forced="True" flag - you need to use 8 instead of C

Additionally it is needed to replace 03 80 00 00 05 for 03 80 00 00 06

But i agree that it would be more convinient to select needed default and forced tracks from gui or cli.`

Wrong Dialog opened when "Browsing" for the output UHD Blu-ray folder (tsMuxerGUI)

When "UHD Blu-ray folder" is selected as the Output type and the Browse button is clicked, a "Select File name" dialog is presented instead of the "Select Folder" dialog. This makes it impossible to select an output folder for the UHD Blu-ray mux. You have to cancel out of the dialog and manually enter the entire path to the folder in the "folder" field.

TSMUXER 2.6.15 on macbook catalina cant detect image file

I just downloaded tsmuxerGUI for mac 2.6.15 and this message keeps popping up? How can this be fixed? I searched for reason and it said I had to download homebrew and delete libefreetype and i did it all in the terminal and and i tried adding the video file again and same message pops up? Below are the attachments

TSMUXER on MAC

Hombrew.txt

Update to the README.md — RE: building instructions for MSYS2

As I had said in the Doom9's forum thread,

"the instructions for building tsMuxer with MinGW-w64 && MSYS2 are not entirely correct, in fact they are a bit misleading;"

So if you intend to keep those instructions in the current state, I think you should at least warn that:

  1. those instructions are intended for the ones who want to use MSYS2 only for building TSmuxer and nothing else;

  2. the QT downloads are HUGE;

Besides: if you compare your instructions with the guide that I posted on Videohelp, you will realize that you're telling the ordinary user to download very-unnecessary stuff:

https://forum.videohelp.com/threads/394148-How-to-setup-an-MSYS2-building-environment

Create Way of Downloading Binaries without Sign-In

We would need to take a look at the Actions API to see if there is a way to create a new release and upload the binaries for each platform, on each push. Shouldn't be too dissimilar to what we have currently.

Main driver is that current system of downloading official binaries is a bit confusing for users and requires a GitHub account.

Stuttering Video

what is the main output needed to export UHD blu-ray folder for audio and video ? I have one 4K video that is ts file? muxing is successful its just that the video stutters and then its fine again.
Here is the video image below. I'm using the latest update tsmuxer for mac.
UHD Video

[Bug] Incorrect TS buffers management

For the record:
TSMuxer calculates the ATS (Arrival Time Stamps) of each M2TS packet by simply dividing the time between two consecutive frames/DTS by the number of packets. This is incorrect (i.e. not complying with T-REC H.222.0 = ISO/IEC 13181-1) and creates constant underflow / overflow of the various TS buffers.

Introduce a uniform formatting style

It would be nice to have all the files in the repository formatted in a uniform way. Unfortunately, currently the sources are a mix of everything, with tabs sometimes occurring alongside spaces, different indenting widths and brace styles. I didn't even have to look far : Base64::decode is a good example.

I find that the best course of action would be to introduce a clang-format file (or a similar tool's configuration, this is just the one I personally use) and just mass-modify all source files in the repository once there are no outstanding pull requests.

UHD Setting and Audio on latest TSMuxer GUI git- 146be40

I would like to know how to set up UHD video setting in latest TS muxer in blu ray tab in options and output in mac? Also what should the audio be set to as well to play on UHD players? Can this vary on different video formats like mkv vs ts or mp4 4K videos?
TS Muxer for mac

Readmes Need Separating and Cleaning Up

The existing readme is very compiling-instructions heavy. It would be better to separate that out into a new document and have the main readme file focus more on the usage of the program.

AppImage tsMuxeR not found

I have again problem with build tsmuxer from arch repo and.... I tried run AppImage lnx-nightly-2020-01-02--01-10-53.zip
and I have this error:
Zrzut ekranu z 2020-01-02 13-57-57

and this is from arch repo
71666581-c77a9a80-2d61-11ea-95ac-80d4234d2eab

Segfault when muxing SRT

The following meta file cause a crash on macos and linux

MUXOPT --pcr-on-video-pid --cbr --minbitrate=7500
V_MPEG4/ISO/AVC, raw/video.h264, fps=25
A_AC3, raw/audio01.ac3
A_AC3, raw/audio02.ac3
S_TEXT/UTF8, raw/sub.srt, video-width=1920, video-height=1080, fps=25

On macos

tsmuxer raw/media.meta test_tsmuxer.ts
tsMuxeR version 2.6.15. github.com/justdan96/tsMuxer
Decoding H264 stream (track 1): Profile: [email protected]  Resolution: 1920:1080i  Frame rate: 25
tsmuxer(28937,0x10cabbdc0) malloc: Incorrect checksum for freed object 0x7fd27a500b18: probably modified after being freed.
Corrupt value: 0x61
tsmuxer(28937,0x10cabbdc0) malloc: *** set a breakpoint in malloc_error_break to debug

Removing subtitles from meta file don't lead to issue.

Your tool is the only one I found able to convert text based subtitle to DVB subs. Nor VLC or ffmpeg can do this sadly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.