master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.51k stars 156 forks source link

rav1e encoding working funky and weird #884

Open thepragmaticmero opened 1 month ago

thepragmaticmero commented 1 month ago

I've battled with the rav1e encoder for a while now. I need help on identifying if I'm encountering a bug or not. OS: Fedora Silverblue rav1e --version 0.7.1 av1an --version 0.4.3-unstable Running on: toolbox enter arch-toolbox-latest podman --version 5.2.2 Running too on: Baremetal Fedora Workstation install, building via cargo


  1. av1an exits my bash script after finishing only one encoding This is my bash script (It's minimalist)

    #!/bin/bash
    # You'll need "av1an" "rav1e" "ffmpeg" "vapoursynth"
    # Parameters
    psv_enc="rav1e" # Encoder
    psv_bitrate="4000" # Target bitrate
    # psv_passes="2" # Number of encoding passes
    psv_threads="16" # Number of cpu threads used, 0 for all
    # psv_quality="80" # Target quality 0-100
    psv_audio="-c:a libopus -b:a 120k" # Target audio and bitrate
    psv_execdir="."
    psv_newdir="av1ado"
    mkdir -p "$psv_newdir"
    # Convert mp4 / mkv to av1
    find "$psv_execdir" \( -iname "*.mkv" -o -iname "*.mp4" -o -iname "*.webm" \) | while read -r file; do
    output="${file%.*}.mkv"
    echo "Converting $file to $output"
    
    # THIS IS THE IMPORTANT PART vvvv
    if ! av1an -e "$psv_enc" -v "--bitrate=$psv_bitrate --quantizer=80 --no-scene-detection --tiles=4 --threads=$psv_threads --speed=4" -y -a="$psv_audio" -i "$file" -o "./$psv_newdir/$output" ; then 
    echo "Error catastrófico"
    fi
    
    touch -m -t "$(stat -c %y "$file" | sed 's/[-: ]//g' | sed 's/\..*//' | sed 's/..$//')" "./$psv_newdir/$output"
    done

    I tried it with the same structure while encoding .jxl using cjxl and I had no problems with my little script. What my script did is transcoding all the .jpeg and .png files to .jxl with it's custom parameters. And copying the "Modified date" from the non-transcoded images. I'm trying to do the same with my videos. But the program keeps exiting after only one encoding.

  2. av1an doesn't change the --workers parameter while using rav1e Using the --workers parameter doesn't change when I'm running the command. Screenshot from 2024-10-09 11-43-57 Workers are supposed to use my RAM efficiently right? I'm not too familiar with the concept, my PC has 32 GB of RAM and I want to use all that I can.

  3. My files are bigger after encoding it with rav1e, even when using --bitrate=4000 The original bitrate is

    $ ffprobe ~/projects/convert/tests/20230701_210323.mp4 2>&1 | grep bitrate # This is the original file
    Duration: 00:00:35.29, start: 0.000000, bitrate: 20205 kb/s
    $ ffprobe ~/projects/convert/tests/av1ado/20230701_210323.mkv 2>&1 | grep bitrate # This is the new av1 file
    Duration: 00:00:35.29, start: 0.000000, bitrate: 37786 kb/s

    The units that rav1e uses are in kbps. Why is it counting it like it was 40 thousand and not 4 thousand? .mp4 size = 89.1MB | .mkv av1 size = 166.7MB

  4. My shell soft locking up after executing one encoding. You need video to understand this. I keep pressing the key "e" multiple times That also happened on Fedora Workstation without the use of podman. Kooha-2024-10-09-12-38-44.webm It's weird, it messes my terminal, if I wasn't using tmux I would be pretty annoyed by that. Why does that happen?


I keep running into these problems, I just wanna use rusty rustacean rust on my whole av1 stack, but I don't know what I'm doing wrong, I replicated the same setup without podman on my other fedora workstation computer, still the same problems.

thepragmaticmero commented 1 month ago

nya

master-of-zen commented 1 month ago

Workers can't be more than there is chunks to work with.

master-of-zen commented 1 month ago

Total queue on that screenshot is 4, so no more than 4 workers can be used. If there is hundreds of chunks (on long videos) - you would create 48 workers you're specified

thepragmaticmero commented 1 month ago

oh ok, yeah the videos are pretty small mostly. Tnks for the explanation, I'm kinda new to encoders. what about the other problems? I think i solved the "high bitrate" problem that I had. But still, I can't use av1an on a bash script.