So can you add support for an OGG Opus codec? Because there is only support of OGG Vorbis in mods...
Opus codec
Moderator: ickputzdirwech
-
- Inserter
- Posts: 43
- Joined: Sat Aug 06, 2016 11:48 am
- Contact:
Opus codec
-
- Inserter
- Posts: 43
- Joined: Sat Aug 06, 2016 11:48 am
- Contact:
Re: Version 1.1.63
There are no plans to add support for Opus at the moment, but never say never. Do you have some specific issue with Vorbis or does it come down to quality/bitrate?nastyslave wrote: ↑Fri Jan 13, 2023 2:51 pm https://opus-codec.org/comparison/
So any chance to add OGG OPUS handle in future versions?
-
- Inserter
- Posts: 43
- Joined: Sat Aug 06, 2016 11:48 am
- Contact:
Re: Version 1.1.63
When I'm trying to add some sounds/music to mods - game absolutely didn's understand half them, because half of .ogg's are OPUS, but this .ogg files are playing normaly with any audio player... Also, the quality of OPUS codec is always higher than Vorbis anyway.
So isn't all of that the reason to handle ALL .ogg files and add OPUS to codecs for Factorio instead of getting half of .ogg-files uncompatible at all...
Re: Version 1.1.63
A google turned up
which seems like a pretty damn stellar recommendation.Opus replaces both Vorbis and Speex for new applications, and several blind listening tests have ranked it higher-quality than any other standard audio format at any given bitrate until transparency is reached, including MP3, AAC, and HE-AAC.
Re: Version 1.1.63
I've been playing around with the Opus codec today. It's working, but it's funny how those comparisons don't mention that decoding is 3-5 times slower than vorbis.nastyslave wrote: ↑Fri Jan 13, 2023 2:51 pm https://opus-codec.org/comparison/
So any chance to add OGG OPUS handle in future versions?
Re: Version 1.1.63
3-5x slower doesn't sound right to me... are you using special implementations? With off-the-shelf tools I find opus is usually a bit faster than ogg at decoding if you count the wall-clock time, and between 50-100% slower if you count the cpu time.
On a Windows machine with WSL/Ubuntu, after running "apt install opus-tools vorbis-tools" and transcoding gleba-1-hero.ogg to opus at bitrate 64 (which sounds transparent to me), the best-of-three times are:
Code: Select all
$ time oggdec -o /dev/null gleba-1-hero.ogg
oggdec from vorbis-tools 1.4.2
Decoding "gleba-1-hero.ogg" to "/dev/null"
[100.0%]
real 0m1.834s
user 0m0.969s
sys 0m0.422s
Code: Select all
$ time opusdec gleba-1-hero.opus /dev/null
Decoding to 44100 Hz (2 channels)
Encoded with libopus 1.4-711-g178672ed
ENCODER=opusenc from opus-tools 0.1.10
ENCODER_OPTIONS=--bitrate 64
Decoding complete.
real 0m1.617s
user 0m1.531s
sys 0m0.047s
Re: Version 1.1.63
No special implementations, just grabbing opus from their github. I didn't use the latest version (but vorbis version used was quite old as well). And it was just a quick and dirty test, I didn't investigate how it behaves with different encoding settings.
But searching around the interwebs I've consistently found Opus being considerably slower than Vorbis.
For example here: https://www.audiokinetic.com/en/blog/a- ... ght-codec/
That being said, I will most likely still go ahead with adding Opus support (so mods can use it, and then any performance impact is on them) and encoding Space Age music with Opus (my goal is to cut the disk size in half, as there is a lot of music data in the expansion).
But searching around the interwebs I've consistently found Opus being considerably slower than Vorbis.
For example here: https://www.audiokinetic.com/en/blog/a- ... ght-codec/
That being said, I will most likely still go ahead with adding Opus support (so mods can use it, and then any performance impact is on them) and encoding Space Age music with Opus (my goal is to cut the disk size in half, as there is a lot of music data in the expansion).
- BraveCaperCat
- Fast Inserter
- Posts: 242
- Joined: Mon Jan 15, 2024 10:10 pm
- Contact:
Re: Version 1.1.63
You do know that you could have discussed audio formats in another topic... Right? At least I think you were talking about audio formats...
Creator of multiple mods, including Quality Assurance - My most popular one. Expect multiple modding-related questions, answers and other posts.
-
- Inserter
- Posts: 43
- Joined: Sat Aug 06, 2016 11:48 am
- Contact:
Re: Version 1.1.63
So can we get .ogg opus support in new factorio versions?
Music files will reduced in size greatly if opus will be used.
Music files will reduced in size greatly if opus will be used.
Re: Version 1.1.63
Most likely yes, soon. We're doing testing and comparisons now, finalizing encoding settings.nastyslave wrote: ↑Fri Nov 15, 2024 7:28 am So can we get .ogg opus support in new factorio versions?
Music files will reduced in size greatly if opus will be used.
Right now it's looking like a ~23% disk size reduction when matching the quality of what we're using now with Vorbis. I was aiming (and hoping) for larger reduction but that would mean a reduction in quality, which I'm not willing to do.
Re: Version 1.1.63
I'd love to read about what you've tried so far! In case you can't tell by the text below
I've written the bash script below to estimate if the "size on disk" overhead is too much (inspired by your wording). Currently, assuming 4KiB sector size it only amounts to ~8 MiB overhead for all Space Age sounds. That's not enough to justify the effort to pack all sounds in some container format (to have 1 file with all sounds as opposed to 2000 small files).
How about increased frame size in Opus?
I've written the bash script below to estimate if the "size on disk" overhead is too much (inspired by your wording). Currently, assuming 4KiB sector size it only amounts to ~8 MiB overhead for all Space Age sounds. That's not enough to justify the effort to pack all sounds in some container format (to have 1 file with all sounds as opposed to 2000 small files).
How about increased frame size in Opus?
Finally I've looked at environmental sounds like 'low-density-inventory-pickup', 'turret-inventory-move' - in the current Vorbis their frequencies end at either ~10kHz or have a very quiet curve and cap around 12kHz. I am not sure how encoders/codecs handle this, would it make sense to encode those at 24 kHz (Nyquist theorem) and at a lower bitrate than game music? In the end... it's just factory noise (with lots of love behind it, right? )https://wiki.xiph.org/Opus_Recommended_ ... e_Tweaking
https://man.archlinux.org/man/opusenc.1
--framesize N
Set maximum frame size in milliseconds (2.5, 5, 10, 20, 40, 60, default: 20)
Smaller framesizes achieve lower latency but less quality at a given bitrate.
Sizes greater than 20ms are only interesting at fairly low bitrates.
Code: Select all
#!/usr/bin/env bash
# Description: counts file sizes in the given folder to estimate the wasted space
# due to sector alignment overhead ("disk size" in Windows' terms).
#
# Example: with a sector size of 4096, but actual file data of 2000 bytes, 2096 allocated bytes on disk remain unused.
# In extreme cases, it would help to pack all files in a container format (say, .ZIP without compression or .tar)
# to avoid per-file overhead.
# USAGE:
# ./script.sh <target folder>
# EXAMPLE:
# ./script "$HOME/.steam/steam/steamapps/common/Factorio/data/space-age/sound/"
# OPTIONS:
# Edit sector_size and max_size_deviation_percent if you want.
set -e
shopt -s nocasematch
target_dir="$1"
# Default is 4096 for Windows/NTFS, Linux filesystems
sector_size=4096
# If less than % of a sector is occupied, count this file for overhead calculation.
max_size_deviation_percent=50
size_bitmask=$(( $sector_size - 1 ))
divisor=$(( (100 / $max_size_deviation_percent ) ))
limit=$(( $sector_size / $divisor ))
printf "Disk sector size for calculations (must be a power of 2): %d\n" "${sector_size}"
printf "Count, if file size within '%d' bytes of sector size\n" "$limit"
total_files_matched=0
total_size_deviation_matched=0
test $divisor -eq 0 && exit 2;
test -d "$target_dir"
while read -d $'\0' line
do
file_name="$(echo "$line" | cut -f2)"
if [[ "$file_name" =~ \.(ogg|flac|opus|mp3)$ ]]; then
byte_size="$(echo "$line" | cut -f1)"
remainder=$(( $byte_size & $size_bitmask / $divisor ))
echo "$remainder <= $limit; $byte_size bytes - $file_name"
if [[ $remainder -le $limit ]] && [[ ! $remainder -eq 0 ]]; then
total_files_matched=$(( total_files_matched + 1 ))
total_size_deviation_matched=$(( total_size_deviation_matched + remainder ))
#echo "counting... $total_files_matched ; $total_size_deviation_matched"
fi
else
echo "File is not music: $file_name"
fi
done < <(du --all --bytes -0 "$target_dir")
# need to count the sector space, once per file, that was not occupied by any data (the remaining free space in a sector)
total_overhead=$(( total_files_matched * sector_size - total_size_deviation_matched ))
printf "Total files matched: %d\n" "$total_files_matched"
printf "Their sector misaligned overhead amounts to: %d bytes.\n" "$total_overhead"
- BraveCaperCat
- Fast Inserter
- Posts: 242
- Joined: Mon Jan 15, 2024 10:10 pm
- Contact:
Re: Version 1.1.63
As I say, again - this discussion should be moved to another thread.
Creator of multiple mods, including Quality Assurance - My most popular one. Expect multiple modding-related questions, answers and other posts.
Re: Version 1.1.63
I have moved the posts to a this new topic.BraveCaperCat wrote: ↑Fri Nov 15, 2024 9:16 pm As I say, again - this discussion should be moved to another thread.
-
- Inserter
- Posts: 43
- Joined: Sat Aug 06, 2016 11:48 am
- Contact:
Re: Version 1.1.63
Great news, guys! Factorio will be moreDonion wrote: ↑Fri Nov 15, 2024 12:02 pmMost likely yes, soon. We're doing testing and comparisons now, finalizing encoding settings.nastyslave wrote: ↑Fri Nov 15, 2024 7:28 am So can we get .ogg opus support in new factorio versions?
Music files will reduced in size greatly if opus will be used.
Right now it's looking like a ~23% disk size reduction when matching the quality of what we're using now with Vorbis. I was aiming (and hoping) for larger reduction but that would mean a reduction in quality, which I'm not willing to do.
Waiting for any news!
Last edited by nastyslave on Wed Nov 20, 2024 9:44 pm, edited 1 time in total.
- BraveCaperCat
- Fast Inserter
- Posts: 242
- Joined: Mon Jan 15, 2024 10:10 pm
- Contact:
Re: Version 1.1.63
Thank you!Donion wrote: ↑Mon Nov 18, 2024 6:48 pmI have moved the posts to a this new topic.BraveCaperCat wrote: ↑Fri Nov 15, 2024 9:16 pm As I say, again - this discussion should be moved to another thread.
*optimized, not potimized. (would be really funny if they accidently added pots to factorio instead of optimizing it...)nastyslave wrote: ↑Wed Nov 20, 2024 5:23 pmGreat news, guys! Factorio will be more potimized soon!Donion wrote: ↑Fri Nov 15, 2024 12:02 pmMost likely yes, soon. We're doing testing and comparisons now, finalizing encoding settings.nastyslave wrote: ↑Fri Nov 15, 2024 7:28 am So can we get .ogg opus support in new factorio versions?
Music files will reduced in size greatly if opus will be used.
Right now it's looking like a ~23% disk size reduction when matching the quality of what we're using now with Vorbis. I was aiming (and hoping) for larger reduction but that would mean a reduction in quality, which I'm not willing to do.
Waiting for any news!
Creator of multiple mods, including Quality Assurance - My most popular one. Expect multiple modding-related questions, answers and other posts.