Comments (3)
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.
Sorry @jscottdouglas but I've decided that it would be too difficult to implement this feature so I am not going to.
from h265ize.
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)
- feature request for disabling autocrop HOT 3
- Question re vobsub2srt integration
- Unable to execute on Fedora 31 HOT 5
- ffmpeg exited with code 1: Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height HOT 2
- Location of settings.json ?
- ffmpeg exited with code 1: HOT 8
- What libraries are required for bitdepth to work? HOT 2
- Saving Stats doesn't work anymore HOT 1
- --watch flag doesn't work
- ffmpeg exited with code 1 - Unable to find a suitable output format for '10' HOT 8
- Date modified / created not preserved
- subtitle streams are sometimes not detected in vob
- Bug - --delete ignores output destination
- Question: is it possible to embed external .srt subtitles inside the output file? HOT 1
- ffmpeg exited with code 1 HOT 3
- new feature: delete only if new file size is smaller
- How can I disable processing output? A quiet mode like ffmpeg?
- Help Setting this up for Jellyfin post Processing (unRAID) HOT 1
- FFMPEG Code error 1 (Is this dead ? Any alternative ?) HOT 3
- Get h265 video file duration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h265ize.