Git Product home page Git Product logo

bdmatch's Introduction

BDMatch

An automatic timeline shifter to match a subtitle from one video to another based on audio spectrum comparison.

Purpose

The shifter can match a subtitle synced to one video to another video. A typical scenario is TV and BD releases for the same episode, from which the project name comes.

The purpose of this project is to save the effort of manual timeline shifting. Generally, it provides better accuracy than manual shifting. It attempts to match subtitles by finding similarities in audio streams. The application of SIMD instruction set and multi-threading allows it to typically process 24 minutes of TV and BD within 10 seconds, including decoding and matching.

Downloads

The latest Windows binary release can be found in the Releases section.

How it works

Two video or audio files and one subtitle file (ASS/SRT) that synced to one of them are needed. For the video files, the first audio stream is loaded. With FFmpeg, different video and audio formats are supported.

For each timeline of the subtitles, the program will extract the corresponding audio spetrum from the source audio stream and match the most similar part of the target audio stream to obtain the offset that should be applied to the output subtitles.

Usage

For Windows users, the executable in Releases provides graphic interface.

For users of other platforms, BDMatchCore, including the core functionality of the project, can be modified and compiled into a command-line executable. A makefile and an example of CLI usage are provided for reference.

Requirements

  • X64 Platform (ARM is not supported currently)

Windows Releases:

BDMatch 1.x (No English Support)

  1. Windows 7 or newer
  2. CPU with AVX instruction set
  3. .Net Framework 4.5 or newer
  4. Microsoft Visual C++ Redistributable for Visual Studio 2019

BDMatch 2.x

  1. Windows 10 1809 (17763) or newer
  2. CPU with AVX instruction set
  3. .Net 8 or newer (Release with .Net runtime is available in Releases)
  4. Windows App SDK 1.5.2 or newer (Releases from 2.0.1 onwards include this runtime by default)
  5. Microsoft Visual C++ Redistributable for Visual Studio 2022

BDMatchCore Compilation:

  1. FFmpeg shared and dev builds
  2. FFTW shared and dev builds

bdmatch's People

Contributors

thomasyse 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

Watchers

 avatar  avatar  avatar  avatar  avatar

bdmatch's Issues

Could work with a single video?

I made a test here with a video that has the right subtitle (DVD rip) to fix for a BD version and work very well, but in some cases, a second video is not available, in many cases we have a single version and a subtitle unsynced which needs to be synchronized, and the program does not accept only one file. Is there a way to just sync this subtitle with a single version of the video?

关于生成的srt字幕符号错误

Describe the bug
A clear and concise description of what the bug is.
目前软件经过作者大佬更新,感觉非常好用,对此表示感谢。但是还有两个小问题向您反馈:
第一个问题稍微重要点,就是目前BDMatch生成的srt字幕时间轴的秒与毫秒之间用英文句号“.”表示,如下图所示:
image
在常用的字幕编辑软件如aegisub和subtitleedit等,会出错或者报错,如下图所示:
image
image
根据维基百科中关于SRT字幕的说明, SubRip (SubRip Text) files are named with the extension .srt, and contain formatted lines of plain text in groups separated by a blank line. Subtitles are numbered sequentially, starting at 1. The timecode format used is hours:minutes:seconds,milliseconds with time units fixed to two zero-padded digits and fractions fixed to three zero-padded digits (00:00:00,000). The fractional separator used is the comma, since the program was written in France.
因此srt字幕正确的格式是将秒与毫秒之间用英文逗号","表示,如下图所示
image

第二个无关紧要,就是字幕打开的界面,既然已经支持ASS和SRT两种字幕格式,可不可以将ALL FILES代替ASS FILES成为默认选项,避免有人误以为不支持srt格式。
image

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Environment (please complete the following information):

  • OS: [e.g. Windows 10 1909]
  • CPU: [e.g. Intel Core i7 6700K]
  • BDMatch Version: [e.g. 1.5.11]
  • Runtime:
    [e.g.
    .NET Framework 4.8
    Microsoft Visual C++ Redistributable for Visual Studio 2019
    etc.]

Ouput of BDMatch
Add text or screenshots here.

Input files
If applicable, upload the file itself is rather than the information.

  • Sub:
  • TV:
  • BD:

Additional context
Add any other context about the problem here.

2.0最新版本无法运行

我下载了您的最新版本,运行后提示需要安装WINDOWS APP SDK,我在弹出来的网站上下载了最新的1.5版本,安装的时候CMD窗口一闪而过,我试了很多种方法,但是无法安装上这个SDK,运行不了软件

真的很喜欢您的这个软件,帮了我很大的忙,看着有新版本却无法使用,心里抓狂

希望作者可以出一个包含SDK的版本

您好,程序运行中途闪退,下面是视频信息

=====TV VIDEO :
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 6.22 GiB
Duration : 2 h 36 min
Overall bit rate mode : Variable
Overall bit rate : 5 699 kb/s
Writing application : Bandicut 3.1.5.509 / Cutter / HS+

Video
ID : 1
Format : AVC / AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4 / Main@L4
Format settings : CABAC / 1 Ref Frames / CABAC / 1 Ref Frames
Format settings, CABAC : Yes / Yes
Format settings, Reference : 1 frame / 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 2 h 36 min
Bit rate mode : Variable
Bit rate : 5 563 kb/s
Maximum bit rate : 16.0 Mb/s
Width : 1 920 pixels
Original width : 1 920 pixels / 1 920 pixels
Height : 1 080 pixels
Original height : 1 080 pixels / 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 29.970 (29970/1000) FPS
Minimum frame rate : 13.716 FPS
Maximum frame rate : 29.970 FPS
Original frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0 / 4:2:0
Bit depth : 8 bits / 8 bits
Scan type : Progressive / Progressive
Bits/(Pixel*Frame) : 0.090
Stream size : 6.07 GiB (98%)
Codec configuration box : avcC

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 2 h 36 min
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 143 MiB (2%)
Default : Yes
Alternate group : 1

=====================================================
=====BD VIDEO :
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 6.55 GiB
Duration : 2 h 36 min
Overall bit rate mode : Variable
Overall bit rate : 5 986 kb/s
Writing application : Lavf57.72.101

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4
Format settings : CABAC / 3 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 2 h 36 min
Bit rate mode : Variable
Bit rate : 5 744 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 29.970 (29970/1000) FPS
Minimum frame rate : 29.960 FPS
Maximum frame rate : 30.060 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.092
Stream size : 6.26 GiB (96%)
Writing library : x264 core 148 r2665 a01e339
Encoding settings : cabac=1 / ref=3 / deblock=1:1:1 / analyse=0x1:0x111 / me=hex / subme=6 / psy=1 / psy_rd=0.50:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=18 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=2 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=25 / scenecut=0 / intra_refresh=0 / rc_lookahead=10 / rc=cbr / mbtree=1 / bitrate=5744 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / vbv_maxrate=5744 / vbv_bufsize=12000 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box : avcC

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 2 h 36 min
Bit rate mode : Constant
Bit rate : 256 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 287 MiB (4%)
Default : Yes
Alternate group : 1

新版本匹配率远低于旧版本软件

您好,我在使用中发现同样的参数设定,使用旧版本1.5.20可以完美匹配,但是使用最新的2.0.1版本却出现大量错误,具体截图如下:

使用1.5.20匹配时,有三个提醒,属于完美匹配

1111

生成的SRT文件,时间轴正确

Snipaste_2024-05-30_19-02-01

使用2.0.1匹配时,警告28个,信息3个,另有一个提示超过音频长度

Snipaste_2024-05-30_19-04-37
Snipaste_2024-05-30_19-04-48

生成的SRT文件,时间轴大量错误

Snipaste_2024-05-30_19-05-45

以上用的是同样的文件,同样的参数设置,但是效果却相差很大,是我哪里用得不对吗

使用您的软件很长时间了,可以给您提两点小建议吗?

1.关于“响度补偿”这个选项,不知道能不能做成自动识别视频响度是否需要补偿,或者在“响度补偿”选项未选中时,在视频提取完成后,能不能显示两个视频的响度以便我判断是否需要补偿响度,比如我在使用中选中“响度补偿”,在视频提取完成后,软件会提示响度补偿详情,这样我可以判断补偿后是否更接近TV视频响度,从而选择让软件继续工作还是停止转而取消补偿。

2.能不能加一个命令行启动的功能,这样我能更方便从CMD中启动它,启动后从命令行自动获取并填写BD,TV,SUB等路径

以上如果对您造成困扰,请见谅

Could work with a single video?

Is there a way to work with a single video only? I did a test here using a version that has a correct subtitle (DVD Rip) and synchronized correctly to another video (BD), but in many cases, there is no way to have a video that has a correct subtitle, a "TV version". Is there a way to just synchronize the subtitle with the version we want? Without using two videos? I tested it here and the program does not accept using only one video

[Feature] Simplify port to other OS

Is your feature request related to a problem? Please describe.

For users of other platforms, BDMatchCore, including the core functions of the project, can be modified and compiled into a command-line executable.

I read that, try to analyze, and see that here

#include <WinSDKVer.h>
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
#include <SDKDDKVer.h>

I can put an ifdef win32 to avoid problem on Linux

But your file https://github.com/Thomasyse/BDMatch/blob/131c6370d5c51c1c90c09fb55bfbcf9e2eea34a5/BDMatchCore/include/instructionset.h at line 4 and with CPU command seems really windows-related

Describe the solution you'd like

Help to create a cross project by putting ifdef condition, thanks

[Bug] BD视频文件路径有中文名,匹配后的ass文件中视频路径就会有编码错误

描述错误
BD视频文件路径有中文名,匹配后的ass文件中视频路径就会有编码错误

重现
重现行为的步骤:

  1. BD视频文件路径有中文名
    D:\新建文件夹\[ReinForce] Heya Camp△ (BDRip 1920x1080 x264 FLAC)\[ReinForce] Heya Camp△ 01 (BDRip 1920x1080 x264 FLAC).mkv
    2.匹配
    3.生成文件如图,Aegisub生成的文件默认的编码好像是UTF-8 BOM
    image.png
    用Aegisub打开报错
    image.png
    将编码改为ANSI后路径名正常
    image.png

环境(请填写以下信息):

  • 操作系统:Windows 10 1909
  • CPU:Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  • BDMatch版本:1.5.19
  • 运行时:
    Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz:使用AVX、AVX2、FMA指令集加速。

[Bug] 无法提交音频至解码器!

AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx :使用AVX、AVX2、FMA指令集加速。

BD文件: jbd-285.mp4

无法提交音频至解码器!

其他视频字幕都是正常的,就这个跳出这个提示,请问是什么原因呢

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.