Use ffmpeg to edit metadata titles for multiple files -


i'd able add/edit video metadata titles multiple files @ once or single command, don't know how tell ffmpeg this.

i read similar post on ubuntu forums, have never used string manipulation in linux before, commands i'm seeing in post way out of comprehension @ moment, , of discussion goes on head.

i've got of video files in filename format includes show name, episode number, , episode title. example:

show_name - episode_number - episode_title.extension

bleach - 001 - shinigami born!.avi

is there simple way read title , episode number filename , put metadata tag without having go through each , every file manually?

edit 1: found out can iterate through files in directory, , echo filename, , told friend try bash parse strings , return values use in ffmpeg command line. problem is, have absolutely no idea how this. string manipulation in bash confusing on first look, , can't seem output want variables. test bash:

 file in "bleach - 206 - past chapter begins! truth 110 years ago.mkv";   extension=${file##*.} showname=${file%% *} episode=${file:9:3}; echo extension: $extension show: $showname episode: $episode;    done 

that outputs

extension: mkv show: bleach episode: 206

which variables i'm going need, don't know how move run in ffmpeg now.

edit 2: believe able, through trial , error, find bash command wanted.

for file in *;   newname=${file:0:-4}_2 ext=${file##*.} filename=${file} showname=${file%% *} episode=${file:9:3} nameext=${file##*- } title=${nameext%.*};     ffmpeg -i "$filename" -metadata title="$title" -metadata track=$episode -metadata album=$showname -c copy "$newname.$ext";    mv -f "$newname.$ext" "$filename";    done 

this lets me parse information filename, copy variables, , run ffmpeg using variables. outputs second file, moves file original location, overwriting original. 1 remove section out if you're not sure how it's going parse files, i'm glad able solution works me.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -