Giter Site home page Giter Site logo

Feature / Question: about h265ize HOT 3 CLOSED

fallingsnow avatar fallingsnow commented on July 2, 2024
Feature / Question:

from h265ize.

Comments (3)

FallingSnow avatar FallingSnow commented on July 2, 2024

To answer the first part, it is possible to add a function to delete tracks that are not eng/unk since the script already identifies the languages. However, we'll have to wait till I have more free time in a week or two.

I would write a script for this. First loop through all the files in a directory and its subdirectories: https://stackoverflow.com/questions/4638874/how-to-loop-through-a-directory-recursively-to-find-files-with-certain-extension (You can use the find function in h265ize to locate all video files). Then run something like mediainfo or ffprobe against each file and parse the output for language: unknown or something. If it finds it, just print the file name.

Here is an example of me parsing the output of ffprobe on each stream of a video file: https://github.com/FallingSnow/h265ize/blob/master/h265ize#L639-L641

from h265ize.

FallingSnow avatar FallingSnow commented on July 2, 2024

Sorry @jscottdouglas but I've decided that it would be too difficult to implement this feature so I am not going to.

from h265ize.

jscottdouglas avatar jscottdouglas commented on July 2, 2024

can you implement labeling unknown tracks to a user input lang?

not as clean as your code but it gets the job done maybe you can get it into somewhere before it copies the audio/video, with plex it requires the video file to have a lang setting otherwise it considers the track to still be unknown even if single auto track is labeled.

#!/bin/bash
setlang='eng'
numStreams=$(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 "$1" | grep -o '\[STREAM\]' | wc -l | awk '{print $1}')
numStreamsFromIndex=$(expr ${numStreams} - 1)
for i in $(seq 0 "$numStreamsFromIndex"); do
    eval $(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 -select_streams $i "$1" | grep -E "codec_name|codec_type|bits_per_raw_sample|width|height|avg_frame_rate|channels")
    language=$(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 -select_streams $i "$1" | grep "TAG:language" | sed -n -e 's/^.*language=//p')
    title=$(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 -select_streams $i "$1" | grep "TAG:title" | sed -n -e 's/^.*title=//p')
    echo "Attempt: 1 Filename: $1 Stream Index: $i    Title: $title    Language: $language    Codec: $codec_type"
    if [ $codec_type = 'video' ] && [ -z "$language" ]; then
        if [ $i = '0' ]; then
            mkvpropedit "$1" --edit track:v1 --set language=$setlang
        else
            mkvpropedit "$1" --edit track:v$i --set language=$setlang
        fi
        fi
    if [ $codec_type = 'audio' ] && [ -z "$language" ]; then
                if [ $i = '0' ]; then
                        mkvpropedit "$1" --edit track:v1 --set language=$setlang
                else
                        mkvpropedit "$1" --edit track:v$i --set language=$setlang
                fi
        fi
    eval $(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 -select_streams $i "$1" | grep -E "codec_name|codec_type|bits_per_raw_sample|width|height|avg_frame_rate|channels")
    language=$(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 -select_streams $i "$1" | grep "TAG:language" | sed -n -e 's/^.*language=//p')
    title=$(ffprobe -loglevel quiet -show_streams -probesize 10000000 -analyzeduration 10000000 -select_streams $i "$1" | grep "TAG:title" | sed -n -e 's/^.*title=//p')
    echo "Attempt: 2 Filename: $1 Stream Index: $i    Title: $title    Language: $language    Codec: $codec_type"

done
exit

from h265ize.

Related Issues (20)

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.