Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/maxpiva/Sushi.Net into main
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpiva committed Dec 25, 2020
2 parents 6071e6f + 5a05ab5 commit 77a27a6
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Maximo Piva

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## v0.9 Beta

This work is based on [Sushi](https://github.com/tp7/Sushi) and the command syntax is pretty similar, the only real difference is that the output parameter is a path, not a subtitle.
I heavy recommend following the original Sushi [Wiki](https://github.com/tp7/Sushi/wiki) before using this program.

## Additionaly Sushi.Net supports:

* Automatic Audio Shifting from different audio languages.
* Multiple Subtitles
* Support Resizing the subtitles (ass,ssa) to the destination video
* Third-party embedding with a standalone library

## Downloads

Windows x86, x64, Ubuntu x64 & OSX x64 binaries can be downloaded from releases.

## Build & Third Party Usage

**Sushi.Net** uses .NET 5 and is a wrapper around **Sushi.Net.Library**.

Binaries builds are published with .NET 5 self-contained and trimmed, any native libraries (Open CV) are included in the build.

**Sushi.Net.Library** can be used in other programs, and it will be uploaded in nuget.org when **Sushi.Net** becomes final.

## How Audio Shifting Works.

Basically, **Sushi.net** will normalize the destination audio stream, then find the silences in the stream, and mark the destination stream into chunks. After that, it will apply a band filter to attenuate the vocals and load both streams into memory. Those chunks will be matched against the source stream. Then the source stream will be reconstructed matching the destination stream chunks positions and saved.

Of course, it can also shift subtitles in the same way original [Sushi](https://github.com/tp7/Sushi) does, and it supports multiple external subtitles as input (space separated) or it can get the subtitles from the --src stream if its a container. (mkv, mp4, etc).

## Example Usage

Being english.mkv and japanese.mkv to different releases from the same show/movie.

```sushi.net --type audio --src english.mkv --dst japanese.mkv```

Will match and English audio stream against a Japanese one, the result will a new English stream that is shifted/synced for the Japanese one.

## Requirements

[FFMpeg](http://www.ffmpeg.org/download.html) For Audio Extraction & Manipulation.

## Optional Requirements

[MKVExtract](http://www.bunkus.org/videotools/mkvtoolnix/downloads.html) for timecode extraction.

SCXvid for keyframe creation. [Windows](https://github.com/soyokaze/SCXvid-standalone/releases) Version. [Linux](https://eyalmazuz.github.io/Linux_Keyframes/) Version. [Mac](https://eyalmazuz.github.io/Linux_Keyframes/) Version. (Follow the Linux Guide replacing apt with [brew](https://brew.sh/))

## Sushi.Net internally uses the following third party libraries.

[CliWrap](https://github.com/Tyrrrz/CliWrap) - Amazing and Simple way to spawn and manage executables.

[NAudio](https://github.com/naudio/NAudio) - It manages all our wave needs.

[OpenCvSharp](https://github.com/shimat/opencvsharp) - Gives us the avenue to use Open CV.

[OpenCV](https://opencv.org/) - Matches the audio streams.

[Thinktecture.Logging.Configuration](https://github.com/PawelGerr/Thinktecture.Logging.Configuration) - Enables us to change the loglevel on the fly.

## Notice

We used a custom build native version of OpenCV-OpenCVSharp, removing all the parts we don't use (Open CV compiled only with core and imgproc modules), reducing the executable in near 80 Mbytes.

There are some retouched scripts and code from the original [OpenCvSharp](https://github.com/shimat/opencvsharp) distribution in the Extras directories, if you want to create the smaller native library version for other linux distributions or maybe the new M1 Macs. Just make sure, you make a pull request ;)

## Future

* Currently the only native dependency is Open CV, and we only use MatchTemplate from it, I'm up to change to a .net replacement in the future.
* Better matcher, better parameters sweet spot, and better vocal filtering.

0 comments on commit 77a27a6

Please sign in to comment.