Skip to main content
Topic: Trim opus lossless/ no transcode: Any tools for that? (Read 3370 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Trim opus lossless/ no transcode: Any tools for that?

Hi

I'm looking for a tool to trim/ cut opus losslessly, without transcoding.
Is there a tool to opus like mp3DirectCut is to mp3 & aac?

- Olav

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #1
I'm interested in this to :-)

I found this development question about it here.

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #2
You can split opus files using mkvmerge's --split option, or using mkvtoolnix-gui. Split files created are in Matroska (.mka) format. You can remux them to ogg/opus using ffmpeg.

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #3
You can split opus files using mkvmerge's --split option, or using mkvtoolnix-gui. Split files created are in Matroska (.mka) format. You can remux them to ogg/opus using ffmpeg.
Thanks. Does it do it losslessly?

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #4
Having tested ffmpeg it can definitely split/crop/edit opus files. It appears to do it losslessly.

Here's a (windows) script I created that you can run that requires you to input the start time of the split and then the end time of the split:

Code: [Select]
:: Name:     opus-split-ffmpeg.cmd
:: Purpose:  Configures ffmpeg to losslessly split/crop an opus file
:: Author:   jaybeee @ themixingbowl.org
:: Revision: Jan 2017 - v0.1

@ECHO OFF

SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

:: variables begin with v

:: set name of this script without file extension
SET vMe=%~n0

:: set name of the parent directory where this script resides
SET vParent=%~dp0

:: set location of ffmpeg ** CHANGE ME **
SET vffmpeg="C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe"


:: Ask for the user to enter the Start & End times in hours, minutes, seconds
echo ** Enter Start Time of where to begin split in hh mm ss.mmm format when prompted **
SET /p vShh="Start Time (hh): "
SET /p vSmm="Start Time (mm): "
SET /p vSss="Start Time (ss.mmm): "

echo ** Enter End Time of where to end split in hh mm ss.mmm format when prompted **
SET /p vEhh="End Time (hh): "
SET /p vEmm="End Time (mm): "
SET /p vEss="End Time (ss.mmm): "

:: convert Start & End input time to seconds
SET /A vStart=(%vShh%*3600)+(%vSmm%*60)+(%vSss)
SET /A vEnd=(%vEhh%*3600)+(%vEmm%*60)+(%vEss)

:: set this variable to Start Time minus 1 second for the fastest seek time
SET /A vFastSeekStart=%vStart%-1

ECHO ffmpeg will now split the file starting at %vStart% seconds and ending at %vEnd% seconds...
ECHO %vFastSeekStart%

:: call ffmpeg to split/crop (copy) out the audio using -ss (start time) & -to (end time) (-t [duration time]) 
:: time can be: [HH:MM:SS.mmm] eg 01:59:58.123 OR in seconds: [S+.mmm] eg 7198.123
:: Please note: -hide_banner will suppress printing the banner info. Ensure you are running an up to date ffmpeg version
:: -ss %vFastSeekStart%
MKDIR split-opus
FOR %%f IN ("*.opus") DO %vffmpeg% -i "%%f" -ss %vStart% -to %vEnd% -map 0:a -c copy "split-opus\%%~nf.opus"

:: Finish
ECHO Finished opus split

:: pause can be used to view the extraction details
PAUSE

:END
ENDLOCAL
ECHO ON
@EXIT /B 0

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #5
Cool, thanks for the answers guys! Think I'll use ffmpeg, like jaybeee suggested. What a tool, I find new uses for it all the time!

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #6
Yeah, ffmpeg really is a great tool. Glad to have helped.


Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #8
It would be good if it had GUI. Without GUI it's shit

Any solution for cutting OPUS files with GUI?

A GUI prog that opens the file and presents you with a waveform to allow you to find where to add the start-cut and end-cut points would be great (like mp3directcut; mp3 & aac only), but at the moment I do not believe it exists (in lossless editing form).

Therefore, maybe you can try expanding you computer skills and use a cmd line program. I even gave you the (windows) script that you simply double-click and up pops a cmd window for you to enter the start and end times (6 numbers in total); not sure how much more simple you need.


Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #9
There are some ffmpeg GUIs.  Google them, try them and see if they offer your particular use as a menu. 

@jaybeee:  I think most users even need to get explained the "copy this into notepad, save it as opuscutter.bat and then doubleclick it" thing.  Oh, maybe Windows will even need you to manually rename it to .bat afterwards.

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #10
On *nix I have this in my mpv input.conf
Code: [Select]
# copy current time to clipboard
Meta+c run "/bin/sh" "-c" "/bin/echo -n ${time-pos/full} | xsel --clipboard --input"
Irc it is in the correct format for feeding directly to ffmpeg. You can probably expand this further to a more auto or a at least semi-auto option.
https://github.com/mpv-player/mpv/issues/4653
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #11
@jaybeee:  I think most users even need to get explained the "copy this into notepad, save it as opuscutter.bat and then doubleclick it" thing.  Oh, maybe Windows will even need you to manually rename it to .bat afterwards.
sadly, you're probably correct... and I'm certainly no techie/coding "guru".

--

I never even thought to look for a GUI when I started out using ffmpeg ~2 years ago. But then I decided to have a play with it and rather enjoyed figuring out the various commands and if I could then create script files to make it easier for me.

Anyway, I found these two (NOT tested by me at all:
1. Avanti GUI - free and allows custom commands to be entered that would in theory allow full use of ffmpeg... but then that negates niga_in_da_block's desire for exclusive GUI functionality. And keeping on topic, it doesn't appear to allow splitting/cutting unless you use the custom command option.
2. myFFmpeg - this is not free (free trail available), but if you were willing to spend a little money on it I dare say it's a winner and would do all you need. If I used ffmpeg everyday I'd seriously consider it. It does appear to allow splitting/cutting (at least for videos, and one would assume audio to).

--

btw the username "niga_in_da_block" is a terrible handle and I would say offensive to many. tbh I'm surprised it even complies with HA's ToS; I would suggest that ToS11 be expanded to include offensive usernames... or create a new one.

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #12
Hey jaybeee--I use your excellent script to losslessly trim Opus files, and thank you!

Q:  Is there a way to alter the script to allow your .bat to operate on only a selected Opus file, via the Windows right-click "sendto" menu, instead of every *.opus file in the directory?  I know this is probably an easy change but being a script novice could not find a way myself after some Googling.

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #13
Cross platform GUI tool for lossless trimming / cutting of video and audio files using ffmpeg
https://github.com/mifi/lossless-cut
| TAK pMax | QAAC ~ 192 kbps |

Re: Trim opus lossless/ no transcode: Any tools for that?

Reply #14
Shinsekai--thank you for the heads up on this!  I have tried LosslessCut today and can verify that it will read and cut Opus audio files.  I replaced the included ffmpeg.exe/ffprobe.exe with the latest release versions from the Zeranoe site and tested the output cut with opusinfo.exe, all seems "as advertised."  Note that GUI interface does not show waveform, you advance through the audio itself by playing it from a simple play/pause control or with a rather rough seek bar but times are shown to the millisecond. Portable but does create a GPU cache folder in User/Appdata/Roaming.  Thanks again for pointing out this tool.

 
SimplePortal 1.0.0 RC1 © 2008-2018