Checking audio successfully converted - finding duplicate audio length in different formats

Sorry if the answer to this is in the forum somewhere, but I cant find it after 30mins looking.

I have just run an overnight bulk audio file conversion and want to check all went well before I delete the originals and file away the new, smaller, different codec versions.

I have two folders. One full of original audio files (mp3, m4a etc) and a second folder full (hopefully) of their successfully converted .opus format new versions.

How do I produce a list of duplicate filenames (but not file types) with the results filtered to only show where audio duration is a match (with an error tolerance of 1 seconds difference either way)?

If this works correctly I should get 1 match, and 1 match only, for every original file. So maybe 1800ish pairs of file matches where the filename and audio duration are the same but the codec is different.

Thanks, in advance, for any help anyone can offer a 'computer semi-literate' with this seemingly quite simple problem.

Getting a list of duplicate pairs like the Dupe Finder produces will require a script.

Are you sure you want that long list?

Aren't the files that don't make it onto the list more interesting?

Have you compared the two folders in their total duration?

Do you use Opus 13?

Yes I am using DirOpus 13.

I want a list of files I can actually work on:

For instance, telling DirOpus to delete all the MP3s & m4bs etc that have a matching filename .opus version that is within 1 sec duration of the original.

Once I've done that large delete operation, ideally I'd be left with zero files in my originals folder (everything converted to .opus correctly and has thus been deleted). If not zero I'd have just a few files left in the originals folder which I'd then know are a problem and need to be attempted to convert in other ways than the succesful batch dbPowerAmp I did overnight.

That's the point of what I am trying to do.

99.95% of the time, conversions have all worked fine and I can delete the originals without a worry but every once in a while there is a file that refuses to convert properly or throws up a snag. Checking them all manually is an incredible time suck. Hence the need to run this operation

I'd use a script column that computes the difference between the original's and the copy's duration.

Thank you kindly for the help. Sadly, my knowledge base is very limited in this field so I have to ask - How would you/one do that?

I am about to do another large batch conversion and so will have a huge collection of, hopefully, pairs of files to match up and delete the originals.

Can anyone help either by telling me exactly what setting up & using a script column entails (thank you, Ixp) or providing some other solution to the problem outlined in my first post.

Thanks

What’s the reason for converting from MP3 to Opus? Both are lossy formats, so you’ll be losing audio quality by doing that, in return for slightly less disk space and much worse compatibility.

With a lossless format as the destination, you can tell good audio converters to verify the output files after conversion. With a lossy format, I think they will at least verify the data is valid.

Maybe you just need to use a converter which does that.

1 Like

Thanks for the suggestion, Leo.

The point of converting down to 16k mono Opus is that, for my level of hearing anyway, audio-books and podcasts sound just as good as 128k mp3 etc. Thus, I am saving a lot of storage space on phones, external drives, pen-drives etc where space is sometimes an issue.

In my experience no converter leaves me with a workable list of files where I can delete all the mp3, m4a etc originals that now have a .opus version matching in duration. That would leave me with just the problematic files that need more attempts to convert or, sometimes, just storing in their original format or deleting depending on whether they are too corrupted to play or just will not convert properly.

In downscaling (?) podcasts and audiobooks like that I am saving literally TBs of space. I listen to a lot of spoken word output.

dbPowerAmp seems to be a pretty high quality converter and does have the option to auto delete successful conversions. The problem is some files it THINKS are successful conversions are actually minutes long instead of hours etc (huge chunks missing). If I set it up to auto-delete it would wipe out originals leaving me with flawed conversions only that cut off 5% of the way in etc. Worse, Id only find out about it months or years later when I went to play the file and found it cut off far too early and by then it might be too late to re-download the podcast etc.

Place the original files in the source and the converted files (.ogg) in the destination. Add this column to the source. It will show the gap in seconds for all files that qualify, and mark those that do not with -999.

function OnInit(initData) {
    initData.name = 'CompareDuration';
    initData.version = '2024-03-29';
    initData.url = 'https://resource.dopus.com/t/checking-audio-successfully-converted-finding-duplicate-audio-length-in-different-formats/49963';
    initData.desc = '';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'CompareDuration';
    col.method = 'OnColumn';
    col.type = 'double';
}

function OnColumn(scriptColData) {
    scriptColData.value = -999;
    var item = scriptColData.item;
    if (item.is_dir) return;

    var dtab = scriptColData.tab.lister.desttab;
    if (!dtab) return;
    if (!dtab.path) return;

    var fsu = DOpus.FSUtil();
    var destItem = fsu.GetItem(dtab.path + '\\' + item.name_stem + '.ogg');
    if (!fsu.Exists(destItem)) return;
    if (item.metadata != 'audio') return;
    if (destItem.metadata != 'audio') return;

    var gap = item.metadata.audio.duration - destItem.metadata.audio.duration;
    if (typeof gap != 'number') return;
    if (gap < 0) gap = -gap;
    scriptColData.value = gap;
}

Save ColumnCompareDuration.js.txt to

%appdata%\GPSoftware\Directory Opus\Script AddIns
1 Like

Wow. Thanks. That's very kind of you. Much appreciated.

Ixp, I added the column, you so kindly scripted for me, and compared the two folders side by side in flat view (mixed, no folders) so that all the files are listed in the same order on both sides.

The column displays -999 for every single file so I guess I must be doing something wrong or have missed something out.

In line 27, change ogg to opus.

Thanks, I just did that.
Saved the column script.
Removed the column and re-added it.

Still the same result.

Yes, I forgot to mention you also need to turn off Flat View.

Sorry to say but even with Flat View off the column produces -999 for everything

Could you send me a pair of files so I can try myself?

Sure. Thanks

How do I send to just you or should I post them up here in forum?