Skip to content

Demuxing

Victor Efimov edited this page Apr 22, 2015 · 6 revisions

Sushi works only on WAV files and cannot perform any demuxing or decoding on its own. But it can use ffmpeg to automatically extract WAV streams and other things from audio/video files. Do note that Sushi does not contain ffmpeg so you have to download it separately and put it into the same folder or add it to your PATH.

There are multiple files that Sushi can use during processing:

  1. Original audio, required
  2. Destination audio, required
  3. Subtitles, required
  4. Chapters
  5. Keyframes
  6. Timecodes

When ffmpeg is not available, you have to specify all these files separately, using the --src, --dst, --script, --chapters, --src-keyframes, --dst-keyframes, --src-timecodes, --dst-timecodes arguments, and both --src and --dst files have to be WAVs. Also --dst-timecodes and --dst-fps can't be used at the same time (same for src versions of these args).

If ffmpeg is available, Sushi will try to extract some of these things for you. You still have to specify --src and --dst arguments, but now:

  • For --dst file timecodes and the audio will be extracted.
  • For --src file timecodes, subtitles, chapters and the audio will be extracted.

By default Sushi will output all extracted data in directory of original file. You can specify another directory using the --temp-dir parameter.

Do note that Sushi will not make keyframes by default.

If there is more than one appropriate stream in the file (e.g. two audio streams) and none of these streams is marked as default, Sushi will print an error and ask you to add the appropriate --src-audio x argument, where x equals the index of the audio stream in the container (it will be printed for you). There are also --dst-audio and --src-script arguments that work like this.

You can still tell Sushi to use some external files instead of extracting stuff automatically using the arguments mentioned above. For example, when --chapters argument is set, Sushi will not try to extract the chapters from the source file.

If there are some chapters in the provided source file but for some reason you don't want to use any chapters at all, you can use --chapters none to disable them. Automatic grouping will be used instead (unless disabled).

Sushi can also use mkvextract instead of ffmpeg for timecodes extraction. For some reason ffmpeg is extremely slow for this so you really want to have mkvextract available in your PATH or the Sushi folder. But don't worry – if it's not found, Sushi will fallback to ffmpeg and everything should still work as expected.

After the job is done, Sushi will delete all the demuxed streams. To avoid this, you can use the --no-cleanup switch.

One more thing you need to know about demuxing – even though Sushi can downsample the audio itself, it uses ffmpeg to do this during demuxing (when used). For example, if you specify --sample-rate to be 12000 and provide an mkv file as --src argument, Sushi will extract the audio as a 12kHz mono WAV. If then you'll decide to use this file with Sushi and specify --sample-rate larger then 12000, you'll get undefined behavior.

Clone this wiki locally