• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Off Topic General Discussion Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...)

    Pages (12): « Previous 1 2 3 4 5 6 … 12 Next »
     

     
    • 0 Vote(s) - 0 Average

    Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...)

    Bring your resources, guides, questions, suggestions, cluelessness. All is welcome.
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #31
    2023-09-04, 09:11 AM
    I mean the LG C1 was the flagship OLED for LG and probably the best rated as far as picture quality goes. Granted, I don't have a 75" screen, so maybe that's where the difference comes in, but I've done a episode to episode comparison and come up pretty empty on what I can spot with an untrained eye. I've never had somebody point out the details I might be missing, though, so could just be I'm not paying attention to the right stuff?

    I also downmix to stereo because I don't have anything but TV speakers to work with. That's sacrilege to most folks, but until I have something that's going to support 5.1+ I'd rather get a better experience with what I have. Though I should probably add it as a separate track instead...hmmm...
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #32
    2023-09-07, 05:59 AM
    I've made things much, much more complicated with a few tricks I'll share tomorrow. Got my A380 running with AV1, doing a three season 4K HDR batch encode, a five-movie 1080p collection, a three-episode anime OVA (new territory), and a 4K HDR DV Remux to stress test and see what happens with some new settings.

    Added some file naming changes with better bash variable substitution, a temporary way to get a stereo + 5.1 track, metadata replacement, default stream selection, maybe a couple other things...

    This is getting to the point where putting it in Python might be easier than rewriting the script each time.
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #33
    2023-09-07, 06:37 PM
    Okay, so what I figured out after trying out a few things is that our friend nyanmisaka, as always, was right. The -global_quality flag doesn't work and causes issues a failure with the av1_qsv encoder. Works great with the hevc_qsv encoder, particularly when used with the -look_ahead option (suggest playing around there). So I tried -qp and everything worked just fine! Did a few 1080p encodes and the quality was alright and the compression was decent. So I tried a 4K encode and the quality was absolute garbage.

    I went back and watched through the entire 1080p encode and there were a LOT of issues. So I tried a MUCH lower QP value. And I got -- what I thought was -- roughly the same file size. Turns out it was the exact same file size because -qp has no effect. Same with -crf. So you can only run av1_qsv by specifying bit rates. Which pretty much kills my mass scripting aims, but this can still be used to batch encode series. The documentation for av1_qsv on the ffmpeg docs absolutely sucks. The options they have listed 100% do not work.

    So if you're looking to do any AV1 encoding with QSV, here are a few tricks I have figured out so far, with some nice ffmpeg and bash tips I threw in because I wanted to know how to do them! Hopefully this is helpful to somebody. I have a few things I want to figure out how to do and there are a few tricks in Python I know how to make happen that I don't know in bash (that might be possible) so I'll see what's up when I have a little free time.

    Code:
    for i in *.mkv; do \
        # Step 1 is to strip a year from these media files all in the 20XX range
        j="${i#20[0-1][0-6].}" && \
        # Step 2 strips the crap afterwards leaving us with "Media.Name" not ideal, but easily scripted
        k="${j%.1920x810.BDRip.x264.DTS-HD.MA.mkv}" && \
        # Keep ffmpeg quiet, but this is too quiet and only shows stats and QSV initialization
        ffmpeg -hide_banner -loglevel warning -v quiet -stats \
        -hwaccel qsv -hwaccel_output_format qsv -qsv_device /dev/dri/renderD129 \
        # Map streams -- you can map a single stream multiple times to create copies for stereo + 5.1
        -i "${i}" -map 0:v -map 0:a:1 -map 0:a:2 -map 0:a:1 -map 0:s:0 -map 0:s:1 \
        # Set default streams -- set mapped audio stream 0 as default, turn off default flag on audio stream 1
        -disposition:a:0 default -disposition:a:1 0 \
        # (Over)write the file's metadata if it's junk -- can be plaintext
        -metadata title="${j}" \
        # Set bit rates -- all subjective, need to experiment with individual media
        # I have been using 4, 6, 10, and 12 as arbitrary test points and setting max at 2x -b:v, bufsize at 4x
        -c:v av1_qsv -preset slower -b:v 12M -maxrate:v 24M -bufsize:v 48M \
        # Look ahead offers better bit rate control but slows down encoding I believe (AV1 limits depth to 100 frames)
        -look_ahead 1 -look_ahead_depth 100 \
        # Set metadata stream data (s=stream v=video 0=index title=key
        -metadata:s:v:0 title='1080p FHD 24FPS AV1 12Mbps ABR' \
        # Even w/ multiple audio streams, set the codec once if you only use one codec
        -c:a libopus -ac:a:0 2 -b:a:0 192k \
        # Don't use -af, use -filter:[stream] if using pan or other filters, as you need stream index
        # if multiple streams exist (e.g., two audio streams and one is 2.0, one is 5.1).
        -filter:a:0 "pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR" \
        # Writing these because they display in Jellyfin on the media page...
        -metadata:s:a:0 title='English OPUS Stereo Dialog Mix' \
        -ac:a:1 6 -b:a:1 256k -metadata:s:a:1 title='English OPUS 5.1' \
        -c:s copy -metadata:s:s:0 title='English' -metadata:s:s:1 title='English (SDH)' \
        "${k} [Extra Info You.Definitely.Need]-AwesomeReleaseGroup.mkv"
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #34
    2023-09-13, 06:18 AM
    Anybody ever seen this message before?

    Code:
    [hevc_qsv @ 0x55c66c60ffc0] Space for SEI is not enough. One SEI will be skipped

    From what I can tell, SEI is generally extra information about encoding that isn't necessary for decoding and shouldn't be used as part of the spec, but I've seen it on a few different files I've encountered. Any way to ensure this data isn't lost when encoding, view it to see if it's even necessary, or drop it when encoding to avoid these messages?
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #35
    2023-09-16, 01:05 AM
    Anybody ever deal with VC-1 video? I have some remuxes in VC-1 that I cannot for the life of me figure out how to deal with. Every decoder I've thrown at them fails. I get a seg fault/core dump with vc1_qsv, vaapi hates them as well and says the bit rate control option is unsupported, normal vc1 decoding errors out as well...everything I've found online says it's a weird, niche format and I've literally never run across it before now. Hoping to work through these whether I have to do a hybrid decode/encode or if I can go full hardware accelerated...

    Not sure if I'm talking to myself in this thread anymore. Might be the case. Occasionally screaming into the void is a good thing...
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #36
    2023-09-16, 01:45 AM
    Intel dropped VC-1 in Arc. Even decoding.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #37
    2023-09-16, 12:48 PM
    Well that's a bummer. Any idea if Raptor Lake/UHD 770 supports it?

    As an aside...where do you find this info? I've been looking all over Intel's site and while Nvidia has a really simple matrix, Intel's documentation sucks.

    Guess I'll give the old-fashioned brute-force method a try. I can go back to the tool I was using previously to pay around a bit and see what results I can get. Appreciate the info that I was at a dead end...
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #38
    2023-09-16, 03:32 PM
    Okay, well a couple hours of trial and error -- mostly due to me not sleeping -- and I have a working "script" for ab-av1 that I'm throwing at this series. Figured I'd share here. I have one I threw together for ffmpeg prior to this that I was going to try for a whole list of series that I put in a spreadsheet I started, but I need to modify based on what I've found out here...

    Code:
    IPATH="/path/to/input/media" && \
    OPATH="/path/to/output/encoded/media" && \
    # desired output extension
    EXT="mkv" && \
    # strips this off the end of filenames, requires spaces and special chars to be escaped
    CLEAN=".1080p.REMUX.VC-1.EAC35.1-LMAO.mkv" && \
    QUAL="BDRip" && \
    RES="1080p" && \
    # release group or source
    GRP="OctAV10" && \
    # audio language/s (e.g., "EN+DE+JA")
    LNG="EN" && \
    # subtitle languages (see above)
    SUBS="EN" && \
    # desired primary audio stream index, mapped 2x by default
    STAUD="0" && \
    # if additional audio streams desired, map here, uncomment appropriate line
    ADAUD="-map x:a:y"
    # desired primary subtitle stream index
    STSUB="0" && \
    # if additional subtitle streams desired, map here, uncomment appropriate line
    ADSUB="-map p:s:q"
    # Set minimum VMAF, ab-av1 default is 95
    VMAF="96" && \
    # Set CRF floor, ab-av1 default is 10
    LCRF="12" && \
    # Set CRF ceiling, ab-av1 ceiling is MAX
    XCRF="28" && \
    # Set desired preset, values vary by encoder, SVT-AV1 default for ab-av1 is 8
    PRESET="4" && \
    # Film grain synthesis level
    FGRN="4" && \
    # Additional mapping, note this will be ordered AFTER all other video, audio, sub streams
    ADDMP="" && \
    # Doom9 'midnight dialog' stereo mixdown audio filter
    AFLTR="pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR" && \
    # Desired metadata condensed to make main script more readable
    MDATA="-metadata title=${MEDIA%${CLEAN}} | Jellyfin \
        -metadata:s:v:0 title='AV1 VMAF ~${VMAF}' \
        -metadata:s:a:0 title='English OPUS Stereo Dialog Mix' \
        -metadata:s:s:0 title='English' \
        -metadata:s:s:1 title='English (SDH)' \
        -metadata:s:s:2 title='English (PGS)'" && \
    #
    #
    # LEFT INTENTIONALLY BLANK
    #
    #
    for MEDIA in "${IPATH}"/*.mkv; do \
        # Get filename from full path
        FNAME=$(basename "${MEDIA%${CLEAN}}")
        ONAME="${OPATH}/${FNAME}-[${QUAL}-${RES}.AV1.OPUS.2.0][${LNG}][${SUBS}]-${GRP}" && \
        TEMP="${ONAME}.temp.${EXT}" && \
        OFILE="${ONAME}.${EXT}" && \
        echo "Beginning auto-encode for ${FNAME}..."
        # auto-encode only handles the AV1 video stream
        ab-av1 auto-encode \
            --encoder libsvtav1 --preset "${PRESET}" --svt tune=0 --min-vmaf "${VMAF}" \
            --min-crf "${LCRF}" --max-crf "${XCRF}" --svt film-grain="${FGRN}" \
            -i "${MEDIA}" -o "${TEMP}" && \
        # let ffmpeg do the heavy (light?) lifting of mapping and audio encoding
        ffmpeg -i "${TEMP}" -map_metadata 0 -map 0:v \
            -map 0:a:"${STAUD}" \
            #-map 0:s:"${STSUB}" -map 0:s:1 -map 0:s:2 \
            -c:v copy -c:a libopus -c:s copy \
            -b:a:0 256k -ac:a:0 2 -filter:a:0 "${AFLTR}" \
            "${MDATA}"
            "${OFILE}" && \
        rm "${TEMP}"; done
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #39
    2023-09-16, 04:20 PM
    (2023-09-16, 12:48 PM)bitmap Wrote: Well that's a bummer. Any idea if Raptor Lake/UHD 770 supports it?

    As an aside...where do you find this info? I've been looking all over Intel's site and while Nvidia has a really simple matrix, Intel's documentation sucks.

    Guess I'll give the old-fashioned brute-force method a try. I can go back to the tool I was using previously to pay around a bit and see what results I can get. Appreciate the info that I was at a dead end...

    https://en.m.wikipedia.org/wiki/Intel_Quick_Sync_Video

    The UHD 7XX iGPUs do have VC-1 support.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    1
    bitmap
    Offline

    Community Moderator

    Posts: 766
    Threads: 9
    Joined: 2023 Jul
    Reputation: 24
    #40
    2023-09-16, 06:11 PM
    Now why would I ever think good documentation should live on the manufacturer's website?
    Jellyfin 10.10.7 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage

    [Image: AIL4fc84QG6uSnTDEZiCCtosg7uAA8x9j1myFaFs...qL0Q=w2400]
    Pages (12): « Previous 1 2 3 4 5 6 … 12 Next »
     

    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode