Coder Social home page Coder Social logo

Comments (6)

anderother avatar anderother commented on August 27, 2024 1

from stemgen.

awesomer avatar awesomer commented on August 27, 2024 1

If you get a ffmpeg command line binary (either for windows directly or WSL linux-for-windows), you can use a command line like the following :

for name in 0 1 2 3 4; do ffmpeg -i example.stem.m4a -map 0:${name} -acodec copy channel${name}.m4a ; done

This runs ffmpeg 5 times, extracting one channel at a time, doing a stream copy with no decode step.

To do this in one command, one can use filter_complex :

ffmpeg -i example.stem.m4a -filter_complex 'channelsplit=channel_layout=5.0[C0][C1][C2][C3][C4]' -map '[C0]' -ac 2 -codec alac channel0.m4a -map '[C1]' -ac 2 -codec alac channel1.m4a -map '[C2]' -ac 2 -codec alac channel2.m4a -map '[C3]' -ac 2 -codec alac channel3.m4a -map '[C4]' -ac 2 -codec alac channel4.m4a # for ALAC input to ALAC lossless output

or

ffmpeg -i example.stem.m4a -filter_complex 'channelsplit=channel_layout=5.0[C0][C1][C2][C3][C4]' -map '[C0]' -ac 2 channel0.flac -map '[C1]' -ac 2 channel1.flac -map '[C2]' -ac 2 channel2.flac -map '[C3]' -ac 2 channel3.flac -map '[C4]' -ac 2 channel4.flac # for ALAC input to FLAC lossless output

(I've used .flac in the second example instead of .m4a because it's lossless to lossless with ALAC input, and FLACs are more supported in external programs than ALAC files. Replace .flac with .m4a and add "-codec AAC" AAC output. The above commands are totally lossless if done with ALAC lossless stems. Unfortunately if done with lossy stem input, this will result in a decode (and re-encode) step, as one cannot combine filter_complex with stream copying.)

For example :

ffmpeg -i example.stem.m4a -filter_complex 'channelsplit=channel_layout=5.0[C0][C1][C2][C3][C4]' -map '[C0]' -ac 2 -codec aac channel0.m4a -map '[C1]' -ac 2 -codec aac channel1.m4a -map '[C2]' -ac 2 -codec aac channel2.m4a -map '[C3]' -ac 2 -codec aac channel3.m4a -map '[C4]' -ac 2 -codec aac channel4.m4a # WARNING! If using AAC input, this does a lossy to lossy recode

These commands appear to produce 5 different stereo files, as expected, though in fairness I have not verified that they are identical to each of the stereo input channels from the Stems. Based on my understanding of filter_complex and -ac 2, they should be.

from stemgen.

benjaminlewandowski avatar benjaminlewandowski commented on August 27, 2024

https://djtechtools.com/amp/2015/09/15/hacking-stems-how-to-extract-instrumentals-from-stem-files/

Here is a guide that may be helpful

from stemgen.

benjaminlewandowski avatar benjaminlewandowski commented on August 27, 2024

If you are in macos you could also use this: https://github.com/faroit/SplitStems

Maybe we could integrate that functionality also here?

from stemgen.

lucellent avatar lucellent commented on August 27, 2024

Thanks for the suggestions!
Sadly the Audacity method doesn't work for me, I installed FFmpeg for Audacity but it doesn't find that specific library
and I'm on Windows

The only "workaround" for me is to import each song in Audition, then extract channels to mono, then combine the L and R channels for each stem... which takes just a very long time per song

from stemgen.

axeldelafosse avatar axeldelafosse commented on August 27, 2024

I wrote Stemsep for this specific use case: https://github.com/axeldelafosse/stemgen/blob/master/stemsep.py

It's using a fork of Stempeg (included in the repo too: https://github.com/axeldelafosse/stemgen/tree/master/stempeg). But as @awesomer pointed out, you can use FFmpeg directly to do this.

If that's a common use case I'll probably add some docs!

from stemgen.

Related Issues (20)

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.