Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Meißner
Scripts
Commits
82f57288
Commit
82f57288
authored
Oct 18, 2023
by
Florian Meißner
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
676e11c0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
helpers/_error.function.fish
+8
-0
8 additions, 0 deletions
helpers/_error.function.fish
helpers/_fish_gen_cleanup_fn.function.fish
+21
-0
21 additions, 0 deletions
helpers/_fish_gen_cleanup_fn.function.fish
vmaf.fish
+43
-0
43 additions, 0 deletions
vmaf.fish
with
72 additions
and
0 deletions
helpers/_error.function.fish
0 → 100644
+
8
−
0
View file @
82f57288
function _error --description 'Call with `_error <msg> <var1> <var2> … <var_n>` to abort the program' --no-scope-shadowing
for i in $argv[2..]
set out $out {$i}={$$i}
end
echo $argv[1] '('(string join ', ' $out)')'
exit 1
end
This diff is collapsed.
Click to expand it.
helpers/_fish_gen_cleanup_fn.function.fish
0 → 100644
+
21
−
0
View file @
82f57288
function _fish_gen_cleanup_fn --argument name body
if [ (count $argv) -ne 2 ] || [ -z "$argv[1]" ] || [ -z "$argv[2]" ]
echo Invalid params '(expected 2, name and body, both non-empty)'
return 1
end
set current_filename (status filename)
if [ "$current_filename" = "Standard input" ]
set -e current_filename
else
set current_filename (systemd-escape --path (basename $current_filename))
set name _cleanup_"$(string escape --style=var {$current_filename}_ | string collect
)"(string escape --style=var $name)_(uuidgen)
# need \; and \<newline> for line break escaping and command delimiting
echo \
function $name --on-event fish_exit \;\
$body \;\
functions --erase $name \;\
end | source
end
This diff is collapsed.
Click to expand it.
vmaf.fish
0 → 100755
+
43
−
0
View file @
82f57288
#!/usr/bin/env fish
set FZF_PROMPT 'Select original file> '
set FZF_STARTING_QUERY 'orig'
set FFMPEG_ARGS (string trim '
-i $vid -i $ORIG -filter_complex \
"[0:v]setpts=PTS-STARTPTS[distorted]; \
[1:v]setpts=PTS-STARTPTS[ref]; \
[distorted][ref]libvmaf=feature='name=psnr':n_threads=8:log_fmt=json"
' | string collect)
. (dirname (status --current-filename))/helpers/_error.function.fish
switch (count $argv)
case 1
set ORIG $argv
case \*
_error 'need original video' argv[3..]
end
set ORIG (realpath (fzf --prompt $FZF_PROMPT --query $FZF_STARTING_QUERY))
set -q MAXDEPTH || set MAXDEPTH 1
set VIDEO_VILES (find . -maxdepth $MAXDEPTH -type f | filter_by_video | string match )
for vid in (find . -maxdepth $MAXDEPTH -type f | filter_by_video)
set vid (realpath $vid)
[ -r "$vid" ] || _error "sanity check failed: video '$vid' not readable" ORIG PWD MAXDEPTH
set output_file {$vid}_vmaf.txt
echo touch $output_file
#TODO comment in [ -w "$output_file" ] || _error "cannot write to '$output_file'" vid
set args_tmp (mktemp --suffix .fish); function ___cleanup_args_tmp --on-event fish_exit; rm -rf $args_tmp; end
echo $FFMPEG_ARGS >$args_tmp
nano $args_tmp
[ ! -s $args_tmp ] && _error
echo $ffmpeg_args
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment