Giter Site home page Giter Site logo

world-manager's People

Contributors

jegasus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

world-manager's Issues

Can only concatenate str (not "NoneType") to str Error on a world

I attempted to use this on one of my worlds and it errors out with:

Traceback (most recent call last):
File "C:\world-manager-0.0.2\jwm_cli.py", line 61, in
my_world_refs = jwm.one_liner_compress_world(
File "C:\world-manager-0.0.2\jegasus_world_manager.py", line 1748, in one_liner_compress_world
my_world_refs.fix_incorrect_file_extensions()
File "C:\world-manager-0.0.2\jegasus_world_manager.py", line 941, in fix_incorrect_file_extensions
new_img_path_for_ref = find_filename_that_doesnt_exist_yet(new_img_file_path_before_extension,
File "C:\world-manager-0.0.2\jegasus_world_manager.py", line 1686, in find_filename_that_doesnt_exist_yet
current_filename = file_path_before_extension + '.' + extension
TypeError: can only concatenate str (not "NoneType") to str

Background images deleted in world converted from roll20

I attempted to use this tool to compress a Tomb of Annihilation world that was converted from roll20 using KaKaRoTo's converter. However, the background images for nearly every scene were deleted.

The background images are stored in worlds/toa/scenes/backgrounds:
Files before
Files after

Here's a sample scene whose background was deleted:
Scene before
Scene after
Console errors after

After running the command, the command line reported the following:
Fixed 1361 broken refs by pointing to `worlds` folder instead of `modules` folder.

The world used to obtain the information above was version 0.1.0 of ToA from the 5etools/Plutonium Foundry world conversions. Prior to running the tool, the world was launched once to raise its system version to dnd5e 0.7.9. Similar results occurred when I ran the tool on my personal ToA world, which was also converted from roll20 using KaKaRoTo's converter. The results were the same regardless of whether "delete unreferenced images" was set to "y" or "n".

OS: Windows 10

Maybe add a (probably best as optional) step to improve webp compression?

Or use a heuristic like 'if greater than 4mb try to reduce size'.
I did it using cwebp and a command like:

for img in $( find . -type f -iname "*.webp" ); do cwebp.exe $img -q 95 -o ${img}.webp; done;
for img in $( find . -type f -iname "*.webp.webp" ); do mv ${img} ${img%.*}; done;

I did it as a two-parter so I could check it the results, but it could probably be done in place.
I couldn't see any difference in image appearance, but the webp files were reduced by 25-75% in size so it seemed well worth it. (Though, it could be that I ran with -q 75 rather than 95 for the above size reduction. Try both and see what seems best.)

Add MP4 to Webm Converter

Hi. Great work.

I use these two files to convert MP4 to webm. Last time I used I got 4,5gb to 2,6gb.

I used Google settings (https://developers.google.com/media/vp9/settings/vod)

Do you think you can add this in a better way?

Thank you.

#!/bin/sh

for file in *.mp4
do
    echo "================================"
    echo "./conversor \"$file\""
    ./conversor "$file"
    echo "================================"
done
#!/bin/sh

## Requirements
# Linux
# apt -y install mediainfo
# apt -y install ffmpeg


## Usage
# optimize NOMEDOARQUIVO.FORMATO
# Example: ./optimize.sh meuvideo.mp4


## Definições
extensao="mp4"
arquivo=$1
arquivosaida="out-2pass.webm"
arquivosaidasemsom="out-2pass-nosound.webm"
tamanho="hd" # pode ser 4k ou hd

## Ativação Opcional
taxadequadros="-framerate 30"
escalar="-vf scale=1920x1080" # Apenas ative se você quer que o vídeo tenha seu tamanho alterado
#escalar="-vf scale=3840x2160" # Apenas ative se você quer que o vídeo tenha seu tamanho alterado


### Principal
echo "====================="
echo 'Otimizar v0.04'
echo "====================="

if [ "$1" != "" ]; then
  echo '===================================================='
  mediainfo $1
  echo '===================================================='
else
    echo "You need to provide a filename."
    exit
fi


## Executa a conversão
if [ $tamanho = "hd" ]; then
  echo '===================================================='
  echo "Comando Executado:"
  echo "ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k -minrate 1500k -maxrate 2500k -quality good -crf 31 -c:a libvorbis -pass 1 -speed 4 $arquivosaida && ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k -minrate 1500k -maxrate 2500k -quality good -crf 31 -c:a libvorbis -pass 2 -speed 4 -y $arquivosaida"
  echo "ffmpeg -i $arquivosaida -vcodec copy -an $arquivosaidasemsom"
  echo '===================================================='
  # Configuração para HD 1920 x 1080
  ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k \
    -minrate 1500k -maxrate 2500k -quality good \
    -crf 31 -c:a libvorbis \
    -pass 1 -speed 4 $arquivosaida && \
  ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 2000k \
    -minrate 1500k -maxrate 2500k -quality good \
    -crf 31 -c:a libvorbis \
    -pass 2 -speed 4 -y $arquivosaida
else
  echo '===================================================='
  echo "Comando Executado:"
  echo "ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k -minrate 6000k -maxrate 17400k -quality good -crf 15 -c:a libvorbis -pass 1 -speed 4 $arquivosaida && ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k -minrate 6000k -maxrate 17400k -quality good -crf 15 -c:a libvorbis -pass 2 -speed 4 -y $arquivosaida"
  echo "ffmpeg -i $arquivosaida -vcodec copy -an $arquivosaidasemsom"
  echo '===================================================='
  # Configuração para 4K 3840 x 2160 (overkill para VTT)  
  ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k \
    -minrate 6000k -maxrate 17400k -quality good \
    -crf 15 -c:a libvorbis \
    -pass 1 -speed 4 $arquivosaida && \
  ffmpeg -i $arquivo $escalar $taxadequadros -c:v vp9 -b:v 12000k \
    -minrate 6000k -maxrate 17400k -quality good \
    -crf 15 -c:a libvorbis \
    -pass 2 -speed 4 -y $arquivosaida
fi

mkdir -p original
mkdir -p otimizado
mv $1 original
#mv $arquivosaida otimizado/$1
mv -- "$arquivosaida" otimizado/"$(basename -- "$1" ."$extensao").webm"
rm ffmpeg2pass-0.log

echo "Finalizado ${1}"
echo '===================================================='

Feature request: add warning if two images have same name, but different extensions

In my case, my original world somehow ended up with two different images with the same name but different extensions:

  • image.png
  • image.jpg

After compressing the world using your tool, only one of the images got converted to .webp - the other image got deleted.

Maybe some sort of warning, or renaming, could occur if multiple images share the same name but have different extensions?

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.