Opus codec
Posted: Fri Jul 29, 2022 6:18 pm
So can you add support for an OGG Opus codec? Because there is only support of OGG Vorbis in mods...
So can you add support for an OGG Opus codec? Because there is only support of OGG Vorbis in mods...
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?
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.
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.
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?
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.
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
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.
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"
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.
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.
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!