-
Notifications
You must be signed in to change notification settings - Fork 3
Questions about compression and formats #4
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
Comments
Hi @rexelbartolome, Actually, and unfortunately, I do not know exactly what is being lost, ffmpeg does the hard work with some sort of default settings (audio and video codecs too). And it doesn't depend on the program: I also use OBS and then ffmpeg directly to just convert videos to mp4 (because I need to upload to web and mkv is not accepted), and they loose very much of their original size (about 75%), but I do not know why. I've just added a new branch where you can set the audio and video codecs manually. It works, but I didn't do benchmarks to check the best configuration possible. You can see the changes here. To apply these changes, you can overwrite the old
Lines that you may want to edit are 55 and 68 for the audio codec (replace If you are interested, any help with this part of the program is very appreciated. I sometimes too had videos exported with strange errors like no audio anymore or very long duration, so this feature will sure be implemented in newer versions if that solve the problem. Thank you again for this hint and feedback, and ask freely if something isn't clear enough. 👋🏼 😃 , |
Awesome! I think we can use aac and h264 for now, since that would the most widely used. And thanks telling me how to replace the js file, I'm not used to having custom builds and navigating through Github 😅 So I used a video of mine, removed the silence, and put the output clip in Resolve. Fortunately, both the audio and video is read correctly by Resolve but the audio and video gets out of sync as time goes on. Though playing the output clip in VLC runs it perfectly with no audio sync issues. My understanding is NLE's like Premiere Pro and Resolve really don't like variable framerate as mentioned here: So we would need to change the framerate of the original MKV file to a constant framerate or https://trac.ffmpeg.org/wiki/ChangingFrameRate Might be useful for this to have field input or maybe dropdown/combo box so you can select you want the video to have an FPS of 24, 30, or 60 or so. Either way we can just start with 30 since that's what I use to export and upload my videos to Youtube. Next up would be understanding how the other settings of the encoders affect the quality. https://trac.ffmpeg.org/wiki/Encode/H.264 Honestly, I can't really tell the difference in video quality after FFmpeg/Handbrake "compresses" it with default values. I've looked into it comparing my source clip and the reencoded clip and I can't tell noticeable differences. Maybe for the types of videos that I do, it's alright, but for others maybe not so. Though if one really wants to preserve video quality, we can utilize using a Don't know much about audio settings and codecs to tell if we need to change the values for that too. So for a standard silence-speedup, maybe we could use Or possibly give the user these settings to play with much like in Handbrake FejaEA6rYj.mp4But again I'm not really sure how this works nor if I wrote down the syntax correctly so I'll leave it up to you how you'll implement it 😅 Another thing I tested out is if you use ffmpeg to convert an MKV file to MP4 with the default values and only afterwards you remove the silence and export that, the output file has a more noticeable difference in quality. Which I guess makes sense since you're compressing it twice. So I guess this just reinforces the fact that we need to be able to finetune the settings inside silence-speedup directly so we only need to reencode and compress the source video once and preserve the most quality. Let me know what you think! |
Hi @rexelbartolome, To change config, again, you have to edit the file manually. I wrote these values and also the codecs as constants, at lines 22 to 30. So they are more visible now. Can you try again with these changes? About the graphical settings, I won't upload a new version soon, but when the time will come, I will add these new variables too. Thank you again, and good holidays, |
I definitely understand, I think having the values editable in a js file for now is manageable enough for me :D I've tried it now but I keep getting an error. My source file is an OBS recording, originally an MKV that's been remuxed to an MP4. If I use
If I use silence speed
I think it has something to do with fps? Also you're very much welcome and good holidays to you too! |
* Constant audio (`aac`) and video (`h264`) codex (editable if needed from `speedup.js`) * New video options: fps, crf and preset Thanks a 8000 lot to @rexelbartolome for [his contribution](#4)
Hi @rexelbartolome, This is a screenshot of the new Export settings box. Hope you'll like it. I've added the most common values, tell me if you need some more options. I still haven't added the possibility of setting the value for Please try this new version and tell me if the bug has been solved. And if your videos are exported with your desired quality. Thanks again for your feedback (it encouraged me to publish a new version) and best wishes, |
That's amazing! I think the CRF and Preset works flawlessly now. But the exported video still has variable framerate for some reason :( I just checked using FFmpeg too. And I've also checked it with Resolve and the audio still desyncs for longer videos.
But basically we would want this VFR value to be 0.000000
Also I'm not sure if this is an error too but when I test for VFR with the file that used
But regardless it's in a much more workable state, so thank you for that 😊 The workaround I'm thinking is I make the source footage have CFR first and then put it in Speedup, or use Speedup first (since it can now export better video quality!) and then change the fps to CFR again in FFmpeg/Handbrake. Though apparently upon testing, if I change the framerate to CFR in FFmpeg/Handbrake first, then put that inside Speedup, I get I've only just realized that it's actually kind of amazing that you got this to work with OBS's variable frame rates, because I'm assuming time codes etc are less reliable in VFR which is why NLE's have such a hard time with them. Edit: I also tried changing the framerate using FFmpeg with this command after the file being sped-up
found in this post: https://stackoverflow.com/questions/45462731/using-ffmpeg-to-change-framerate It ran fine on VLC, I also tested it out with But when I go and put it on Resolve, it still has a weird delay that becomes worse over time. And the video went longer than the audio, which you can see here, I had to speed up the entire vid to 102% so that the video and audio syncs up. |
Hi @rexelbartolome, Then I thought about the version of ffmpeg that I bundled with Silence SpeedUp, and actually there are updates available. So I downloaded the latest version ( If this won't work, I don't know what to do, because I cannot reproduce this error anymore... In this case, could you send me a video that gives you the error? |
Okay I'm actually losing my mind... But apparently the same file I have a problem with works completely well with Shotcut too, no audio desyncing. I think it's because Shotcut is also based on FFmpeg so it can easily read what it just exported. And Resolve is just really picky when it comes to handling video formats and framerates. When I use the Speedup-exported file, with QWLphkjHx4.mp4I then put that exported vid in Handbrake with the shown settings and after putting that in Resolve, it now works flawlessly K4b7AftvrM.mp4So this leads me to believe it's because the video Speedup is exporting is still VFR and not CFR. If you want to test it yourself, Resolve has a free version and you can download it yourself. Or you can just use the
command to check for variance. I guess a hacky way of solving this would be automatically using this command on the exported video. This pretty much solved my audio desync and fps problem. The process even took less than a second because there's no reencoding, only remuxing.
I then used the output.mp4 and it works flawlessy both in Resolve and VLC. I also experimented with using the remuxing command on videos exported using old Speedup, the version before you added the codecs options. But some errors came out Here's the input video codec info: And here's what happened in FFmpeg
So I just stopped it. So it might not be as simple as remuxing everything 😅 I feel like we're so close to solving this too! I feel like so many teachers can benefit from this. Maybe even other content creators who do commentary over playthroughs too, as well as people who are into editing podcasts. I really appreciate you developing this, and even making it open source! I guess one last thing, could you add an audio notification or something when Speed up already finished exporting all the items in queue? I don't see the green bar thing on the task bar anymore and I don't usually use the pop up version since I like to browse while it's going through the process. Thanks so much! |
Also found this neat little tool: https://sourceforge.net/projects/videoconvertertranscoder/ And how it batch remuxes stuff is much more simple, instead of
I think it only uses a single line per input video so for example this is the command when I used a sample video
Not sure how it works but I think |
Hi @rexelbartolome With this in mind, what do you think about a new checkbox that gives the user the possibility to choose if the concatenation should or shouldn't be re-encoded? |
Yeah I wouldn't want it that way either :( . We've already reencoded the video once so I don't think we should add another reencoding. Then how about adding a way to automatically remux the output video to the proper framerate? Since it's just remuxing, it would be instantaneous. And remuxing seemed to have worked well for me even with the videos made on the older versions of Speedup, the pts and timestamps errors only seem to happen when I use this:
But no errors come up if I use this instead:
Though now that I think about it, I think we should still keep |
Hi @rexelbartolome One thing came to my mind these days: what if the problem is about the As soon as I have time, I'll delve into the matter. |
Which problem are you talking about? That the audio and video are still desynced once remuxed? :o I can't really tell right now with the latest release (thanks btw! 😊) Here's a comparison between the 1.2.2 output vs 1.2.3 output (watch with audio), same settings and source obs remuxed mkv-to-mp4 video: Resolve_v6EMTwwB7f.mp4Resolve only has trouble playing the frames if the |
Wait, do you mean that audio and video are now correctly synced? |
Yeah, as far as I can tell, there's no desyncing going on the speededup outputs of version 1.2.3 😄 |
The only thing that I added is the option I thought that the de-sync error was still there because the filter |
Yeah I guess so. I didn't understand a whole lot on what you said about the encoding changed and splitting regarding concatenation 😅. Might still be the case that there's desyncing going on but I would only notice it on videos way longer like 30mins? Before it was noticeable on videos around 5 mins (like my recent example) but now that doesn't seem to be the case. But yea ideally it should return a value of After doing some tests I, it actually returned that the
But it might just be a small discrepancy since they don't have the same Tune and CRF when I processed them After some reading, Resolve is somewhat capable of reading |
I bring bad news :( It still has a delay on longer videos. I've tried the 28 min video now (removed silence, not sped up) and the same thing happens: it works fine in VLC, but has a delay in Resolve once you look into the later parts of the video. Fortunately the delay is less drastic compared to older versions. This is what it what the output looks like in Resolve, this is around 24:50 from the source video(which is 28 mins long). Resolve_CARF2ijQMY.mp4Remuxing it doesn't really help now either, the delay is still apparent after remuxing, not sure if anything else changed. I guess the only workaround would be to preemptively split longer recordings into shorter clips (i.e., split into 10 min long clips ) using another program (like MKVToolNixGUI) so the delay doesn't get progressively more noticeable the longer it goes. This also leads me to believe that you might be right about the start and end frames of each fragment messing up the audio |
Heya! Just wanted to follow up on this, if you need help with testing let me know :) If you're still busy, I completely understand so no pressure Also planning on sharing this with the teachers from my school too but they work with longer videos ~1 hr. Not sure if this VFR thing going to be a problem when it's going to be played through an online video player or Youtube. AFAIK Youtube reencodes the video anyway so desync might not be a problem. I assume you've used this in your university and no problem has come up? 😮 |
Hi @rexelbartolome, I'm still busy these days, but I didn't forget about this issue. I developed this tool mainly to speedup my university's lessons (1.5 - 3h of videos), and - for almost all - I haven't noticed any delay. But I should also say that I used the "remove" option only for a few videos.. and - most important - these lessons were not of high quality, so if were any desync I wouldn't had noticed it at all. |
I looked at some Reddit posts about Resolve, and this tool appears in the comments (I guess I have to thank you 😄). Those comments got me think: would it be a good feature to interrupt the tool after detecting silences, then have a new window where you can watch, edit and optionally export all the silences? And only after, continue speeding up the videos? |
Hmmm I've tried another program like that here in github, it was built in python I think but the workflow wasn't really great. It spits out all the silence time stamps then when you click on one, it would play it back to you. It needed to open and close VLC when looking through the silences and overall I think it's not really the best way to handle it. I think a better way is for Speedup to export an XML file that Resolve could read as a clip that's been pre-cut so the user just needs to delete the sections they don't need or an EDL file of some sort that Resolve could read as Markers/Chapters so the user can just use those markers as a guide on where the silences starts and stops. So playback and selection of silences is all done inside Resolve and not in Speedup or VLC or any other media player |
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! 😊
The text was updated successfully, but these errors were encountered: