mmguero / cleanvid

cleanvid is a little script to mute profanity in video files
BSD 3-Clause "New" or "Revised" License
56 stars 6 forks source link

Multiple Audio Tracks #36

Open Protoc0l opened 4 months ago

Protoc0l commented 4 months ago

Thank you in advance for the help. If the mkv container has mutliple audio tracks (7.1, 5.1 and stereo), is there a way to edit/cleanvid each audio track keeping the format of each track including multitracks? Currently it seems to be keeping only one if multiple tracks are present and converting then to audio (aac). Even if i split the audio tracks to different mkv containers and process them individually with cleanvid, they seem to all be audio (aac) after processing each split audio track. (PS thank you for making this script, it has revolutionized my video processing for our familiy!)

mmguero commented 4 months ago

Thanks for the suggestion! I'm not getting much time to update this project these days but I agree with the usefulness of this, and will take it under advisement.

Protoc0l commented 4 months ago

Splendid thank you, i look forwards to this if it becomes a thing! After a lot of testing I had decided to just clean up the 5.1 surround and then convert it afterwards to stereo so i have both 5.1 and stereo edited which should work pretty well. Thanks for getting back to me!

davidpeele commented 2 months ago

After doing testing on this, it seems an amazing option for 5.1 audio would be to mute only the center, and front channels leaving the rear channels complete as most if not all dialogue comes from the front and especially the center channel. This option is well beyond my ability and understanding of python programming, but maybe somebody else could help out in disregard. Otherwise, this is a great tool. That does pretty much what I was hoping for. Thank you for your work on this!

mmguero commented 2 months ago

I'm releasing a v1.7.0 that should handle this by adding options for --audio-stream-list and --audio-stream-index index. For example:

$ cleanvid -i Princess.Mononoke.mkv --audio-stream-list
1: aac, 48000 Hz, stereo, jpn
2: aac, 48000 Hz, stereo, eng
$ cleanvid -i Princess.Mononoke.mkv --audio-stream-index 2
$cleanvid -i Princess.Mononoke.mkv
Traceback (most recent call last):
  File "cleanvid", line 8, in <module>
    sys.exit(RunCleanvid())
             ^^^^^^^^^^^^^
  File "cleanvid.py", line 834, in RunCleanvid
    cleaner.MultiplexCleanVideo()
  File "cleanvid.py", line 565, in MultiplexCleanVideo
    raise ValueError(
ValueError: Multiple audio streams, specify audio stream index with --audio-stream-index

The other, non-selected audio streams should go straight into the output video file as-is, completely untouched. The selected audio stream should be the only audio stream that's affected by the filter.

I'm interested to hear everybody's experience with this.

mmguero commented 2 months ago

Note that my use case is more for multi-language files rather than different stereo encodings, but I think it should work the same way. If not let me know.