Git Product home page Git Product logo

padvincenzo / silence-speedup Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 4.0 1.94 MB

Speed-up your videos speeding-up (or removing) silences, using FFmpeg. This is an electron-based app.

Home Page: https://vincenzopadula.altervista.org/silence-speedup/

License: GNU General Public License v3.0

JavaScript 71.31% HTML 14.75% CSS 13.94%
silence-speedup video-editing silence ffmpeg videos electron electron-app silence-skip skip-silence speedup

silence-speedup's Introduction

Silence Speedup

Speed-up your videos speeding-up (or removing) silences, using FFmpeg.

Homescreen

Read this in other languages: English, Italian.

Table of Contents

Getting started

This program, built with Electron, makes use of FFmpeg in order to speed up (or skip) parts of the video that are with no sound.

It is really helpful for video lessons, where the professor takes long time for writing something on the board, makes lots of pauses, or just speaks slowly. With this program you can skip this boring parts and save time.

Of course this program is not perfect, and you might have to practice a bit with it.

Download

How to use

Import your videos, choose the program settings and press Start. The app shows you the progress status, which consists of 3 steps: Detecting silences, Exporting and Concatenating.

Not all videos are with the same audio volume, and you may want to choose which silences should be treaten as that. So, here we have the configurable parts.

Silence detect

These settings change the way FFmpeg detect silences. You can set:

  • The background noise of the video (Low for a silent room with a microphone, Mid for the average noisy room, High for a noisy room).

    Note: if your are new, try a video with defaults settings and see the result.

  • How many seconds the smallest silence lasts (this value prevent brief pauses to be treaten as silences).

  • How many seconds of silences should not be treaten as silences.

    Explaination: without a minimum time of margin, spoken words might merge and the result would be an incomprehensible speech.

Filter

With these settings you can change the speed of spoken/silence parts of the video, and also set silence parts to be video-only.

Export

Choose the format (extension) of your video (default is set to keep the same extension as the input file). Other settings include fps (frame per second), cfr and preset (these are settings for the video codec h264). The codec used for audio is aac.

Note: the default path of the videos (as well as temporary files) is set to <your home path>/speededup/. If you want to change it, press the settings button or go to File -> Settings.

Compiling

This program does not need to be installed to run, as I packaged it with electron-packager. But, if you want to compile and run this program by yourself from the source code, then:

$ git clone https://github.com/padvincenzo/silence-speedup
$ cd silence-speedup
$ npm install
$ npm start

If you also want to embed the FFmpeg binaries, here is explained how to.

Note: if you wish to run this program from source files then you also need to install NodeJS.

How it works

For each video, this program will:

  1. Run ffmpeg with silencedetect filter, in order to get the list of silences' start/end timestamps.
<ffmpeg bin> -hide_banner -vn \
  -ss 0.00 -i <Input file> \
  -af silencedetect=n=<threshold>:d=<duration> \
  -f null -
  1. Using that list, split the original video in a tmp folder, applying a speed filter, if any.
<ffmpeg bin> -hide_banner -loglevel warning -stats \
  -ss <Start time> -to <End time> -i <Input file> \
  -filter_complex "[0:v]<setpts filter>[v];[0:a]<atempo filter>[a]" \
  -map [v] -map [a] <Output fragment>
  1. Concatenate all the fragments generated before.
<ffmpeg bin> -hide_banner -loglevel warning -stats \
  -f concat -safe 0 \
  -i <Fragment list file> \
  -c copy \
  -map v -map a <Output file> -y

Note

At the end of execution, the program does not automatically clean the tmp folder.

Contributing

Anyone can contribute to this project, in many ways:

  • Sharing the project;
  • Translating this project in other languages;
  • Finding and report/fix bugs;
  • Suggesting new ideas;
  • Implementing new functionalities.

For any doubt or perplexity we can discuss here.

Credits

This software uses binaries of the FFmpeg project, which I do not own, under the GPLv3.

silence-speedup's People

Contributors

dependabot[bot] avatar lapentab avatar padvincenzo 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

Watchers

 avatar  avatar  avatar

silence-speedup's Issues

Multiple Audio Channel Exporting

Is your feature request related to a problem? Please describe.
I have a use case where I am recording videos with OBS that have multiple audio channels. I record my voice to the first audio channel and the rest of the audio to the second channel. The intent is to maintain the audio channels but only check for silences on the first audio channel. I was hoping that the output would manipulate the video from the first channels silences but then export the video afterward with all the audio channels. Unfortunately the output is only maintaining the first audio channel.

Describe the solution you'd like
I would like to have an option to enable multiple audio channels through the GUI when exporting. However only detect silences from the first channel as is the case currently.

Describe alternatives you've considered
I looked this up to see if these options existed. I skimmed the discussion here https://stackoverflow.com/questions/37820083/ffmpeg-not-copying-all-audio-streams/54616353 to get an idea if this is a potentially reasonable request. On top of this search, the description of how the steps approach the silence detection and video manipulation seem to allow for this change.

I have tried mixing the channels and I can get similar cuts if I make the channel I do not want to detect silences in quiet compared to the voice and maintain the default background noise MID setting. Unfortunately this also removes the audio considered as background noise which I would like to keep through this multiple channel solution.

Additional context
Here is the setup I am describing in OBS:
image

[BUG] Buttons aren't responding

UI doesn't seem to respond to clicks and basically no button is working on ver 1.2.4

Steps to reproduce the behavior:

  1. Extract 1.2.4 win32-x64 standalone version
  2. Open Silence-Speedup
  3. Interact with buttons (see attached)
Silence_SpeedUp_eOUCEYXTzg.mp4

Easier changing of file paths and Speech Min Duration

Accessible changing of the file path and a default file path based on input video:

I'll just put my other requests here so I don't clutter the other thread. I constantly change my file path or export folder. So by accessible I mean that the folder where speedup puts the videos is not locked inside the preferences. Most video remuxers and reencoders have the file path ready to be changed inside the "homepage" itself so you can just type it without going inside another menu

For example: Handbrake
image

By default file path, I mean that the resulting speededup video would default to the same folder as the input video. Not sure how this should behave when multiple input videos have different directories though I'd assume it would only consider either the last or first input video and use that file path for the whole list.

A simple suffix for the resulting video is alright with me like Windows' addition of (1) or maybe -speededup since they would be on the same folder, this is also the standard behavior of other reencoders. I rarely use the default %user%/speededup directory since I organize my files on a per project basis. I'd assume people would also organize it on a per subject/course basis so they don't mix up different lectures.

Say the input video is E:\_Work\Edits\2022\Q1\krita-course\source\batch3\demo5.mp4
then the default file path would be E:\_Work\Edits\2022\Q1\krita-course\source\batch3\
and the resulting video name would be demo5 (1).mp4

Speech Min Duration

When I'm editing, besides the fact that all silences have been removed thanks to this wonderful tool, I'm mainly focused on editing out the weird jumpcuts that happens when I bump into something or when I type that results in a bit of spike in sound. What happens then is I jump to a specific pose for a split second and then I go back to talking. This looks a bit silly especially when I cough ๐Ÿ˜‚ (but I've learned that it's better to mute myself when I'm going to cough so I don't have to edit it out later).

So the Speech Min Duration would refer to how short of a time would sound be considered as actual speech and not just a random noise. A lot of people and teachers trail their speech too when they talk so it would work well with that i.e., instead of saying a short "So I guess that's about it, class dismissed" it would likely be more "Soooo... I guessss... that's about it... class dismissed". Not sure how well it would work since we still use short words from time to time. Regardless, I think a slider for Speech Min Duration much like Silence Min Duration would be pretty useful. And of course I still understand you're pretty busy so I don't want to come off as demanding ๐Ÿ˜…

[BUG] FFmpeg: Cannot allocate memory

FFmpeg gives an error when encoding a long video or a long fragment:

Cannot allocate memory
Failed to inject frame into filter network: Cannot allocate memory
Error while processing the decoded data for stream #0:1

Questions about compression and formats

Hello, I'm a teacher and I really like using this tool, helps a lot with the editing. I'm just curious on how this handles compression. As from what I've seen, My 300mb OBS mkv videos will turn into 75mb with only 20% detected as silence. I'm assuming it's because of the compression and sometimes transcoding it (while keeping the same container, in this case MKV).

What's exactly being lost here? Is it mainly audio quality? both video and audio? bitrate? And is there a way for me to keep the quality the same on the exported file?

I'm not familiar with ffmpeg too so I also want to ask if you've done any benchmarks regarding the performance between file formats etc.

Is keeping the file format i.e., MKV to MKV slower or faster than using other formats?

Also one last thing, when I export this to MP4, the codecs that comes with that has some problems with Davinci Resolve (sometimes audio is lost entirely, or the audio gets a bigger delay on later parts of the video). So my workaround is to use this on the raw clips, MKV to MKV, then use Handbrake to transcode it to MP4 with more compatible codecs.

Is there a better way for me to tell Silence-Speedup to simply use specific codecs instead of the default ones so that I don't have to transcode it twice? I'm not used to using command-line interfaces but I'm willing to learn if I need to.

Again, thanks very much for this tool! ๐Ÿ˜Š

Preview Sample

Is your feature request related to a problem? Please describe.
Waiting for the export to finish and to check it after that is cumbersome.

Describe the solution you'd like
It would be great if it had the ability to generate a short sample as preview.

Describe alternatives you've considered
Trimming a clip from the original and using it as sample can work, but it takes time.

[BUG] UI elements overlapping due to Windows forcing "sane" resizing logic

Describe the bug

For my monitor resolution of 1600 x 900, the window opened with the buttons for starting and to switch to progress mode covered by the lower portion of the window which reports the time, speed, and current status. This prevented me from using the buttons.
I was able to get around this by making my taskbar location go to the left or right side. This freed up about 40 pixels or so of space which allowed the buttons to be only half covered but clickable.

To Reproduce
Steps to reproduce the behavior:

  1. Run the Executable
  2. Try to click on the buttons
  3. try to resize the window
  4. Windows enforces "sane" resizing rules and maintains the UI overlap

Expected behavior
I expected the buttons to be clickable and not covered

Screenshots

image
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 20H2

Additional context
There wasn't any other issue. Things worked beautifully outside of the minor hiccup in the GUI. I appreciate you making this!
It would be nice if the GUI was changed to correct this - perhaps by using some of the empty space within the window's left side.

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.