Compare commits
4 Commits
b9709088a7
...
f30f6eaa69
Author | SHA1 | Date | |
---|---|---|---|
f30f6eaa69 | |||
221985eca2 | |||
06f155f3f7 | |||
648e9bcce5 |
64
bin/convert-video-mkv-to-mp4
Normal file
64
bin/convert-video-mkv-to-mp4
Normal file
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This is for reencoding an mkv video to mp4 using an mpeg4 encoder.
|
||||
# Can optionally compress the video.
|
||||
|
||||
if which tput >/dev/null 2>&1; then
|
||||
ncolors=$(tput colors)
|
||||
fi
|
||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||
RED="$(tput setaf 1)"
|
||||
GREEN="$(tput setaf 2)"
|
||||
YELLOW="$(tput setaf 3)"
|
||||
BLUE="$(tput setaf 4)"
|
||||
MAGENTA="$(tput setaf 5)"
|
||||
CYAN="$(tput setaf 6)"
|
||||
BOLD="$(tput bold)"
|
||||
NORMAL="$(tput sgr0)"
|
||||
else
|
||||
RED=""
|
||||
GREEN=""
|
||||
YELLOW=""
|
||||
BLUE=""
|
||||
MAGENTA=""
|
||||
CYAN=""
|
||||
BOLD=""
|
||||
NORMAL=""
|
||||
fi
|
||||
|
||||
if [[ $1 == "" || $2 == "" ]]; then
|
||||
printf "${BOLD}${RED}Format: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
compress="$1"
|
||||
|
||||
filename=$(basename -- "$2")
|
||||
extension="${filename##*.}"
|
||||
filename="${filename%.*}"
|
||||
|
||||
output="$3"
|
||||
if [[ $output == "" ]]; then
|
||||
output="${filename}_CONVERTED"
|
||||
fi
|
||||
|
||||
printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' | compress: $compress | output: $output.mp4${NORMAL}\n"
|
||||
|
||||
if [[ $compress -eq 1 ]]; then
|
||||
temp_output="temp_$output.mp4"
|
||||
else
|
||||
temp_output="$output.mp4"
|
||||
fi
|
||||
|
||||
# convert first.
|
||||
# we convert then compress instead of compressing on first pass because this results in a slightly higher bitrate.
|
||||
ffmpeg -y -stats -loglevel level+error -i "$filename.$extension" -vcodec copy -acodec copy "$temp_output"
|
||||
|
||||
if [[ $compress -eq 1 ]]; then
|
||||
compress-video 1 "$temp_output" "$output"
|
||||
rm "$temp_output"
|
||||
else
|
||||
printf "\n"
|
||||
fi
|
||||
|
||||
printf "${GREEN}${BOLD}Done encoding '$filename.$extension' to '$output.mp4'${NORMAL}\n\n"
|
80
vimrc
80
vimrc
|
@ -121,6 +121,8 @@ let g:campo_custom_search_args = ""
|
|||
" CTAGS
|
||||
""""""""""""""
|
||||
|
||||
" I use the ctags executable from https://github.com/universal-ctags/ctags-win32/releases
|
||||
|
||||
" If != 0 then ctag generation will always happen on a file save, otherwise
|
||||
" it'll only be triggered if the file being saved has an extension in the
|
||||
" g:campo_extensions_that_run_ctags list.
|
||||
|
@ -1064,7 +1066,7 @@ augroup END
|
|||
hi def link MyNotes Notes
|
||||
|
||||
augroup vimrc_notices
|
||||
au!
|
||||
autocmd!
|
||||
autocmd Syntax * syn match MyNotices /\v<(WARNING|IMPORTANT):/
|
||||
\ containedin=.*Comment,vimCommentTitle
|
||||
augroup END
|
||||
|
@ -1099,23 +1101,65 @@ augroup END
|
|||
" AsyncRun status line
|
||||
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
|
||||
|
||||
" Display error highlighting in source after running GCC with AsyncRun
|
||||
" NOTE: error results can be cleared with <leader>cr or by hiding the build
|
||||
" result window.
|
||||
" "make" value is needed for asyncrun to work with the errormarker plugin
|
||||
" https://github.com/skywind3000/asyncrun.vim/wiki/FAQ#can-asyncrunvim-trigger-an-autocommand-quickfixcmdpost-to-get-some-plugin-like-errormaker-processing-the-content-in-quickfix-
|
||||
let g:asyncrun_auto = "make"
|
||||
|
||||
" Error and warning gutter characters.
|
||||
let errormarker_errortext = "E"
|
||||
let errormarker_warningtext = "W"
|
||||
|
||||
" Thanks to https://forums.handmadehero.org/index.php/forum?view=topic&catid=4&id=704#3982
|
||||
" for the error message formats
|
||||
" Error and warning gutter character colors. See color file for the group definition.
|
||||
let errormarker_errortextgroup = "ErrorMsg"
|
||||
let errormarker_warningtextgroup = "Notices"
|
||||
|
||||
"""""""""""""""""""""""""
|
||||
" Custom error formats
|
||||
"""""""""""""""""""""""""
|
||||
|
||||
" @note: You can debug the error parsing by running :ShowErrorEntries
|
||||
" This will print the valid entries. You'll know parsing is correct when the
|
||||
" entries have a type, line num, error message, etc.
|
||||
|
||||
function! s:ShowErrorEntries()
|
||||
" Prints out valid quickfix errors.
|
||||
redraw!
|
||||
for l:d in getqflist()
|
||||
if l:d.valid == 1
|
||||
echomsg l:d
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
command -nargs=0 ShowErrorEntries call s:ShowErrorEntries()
|
||||
|
||||
|
||||
" Jai
|
||||
"
|
||||
" Microsoft MSBuild errors
|
||||
set errorformat+=\\\ %#%f(%l\\\,%c):\ %m
|
||||
" Z:\path\main.jai:100,10: Error: Undeclared identifier 's1'.
|
||||
set errorformat=\\\ %#%f:%l\\,%c:\ %t%[A-z]%#:\ %m
|
||||
|
||||
" Microsoft compiler: cl.exe
|
||||
set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m
|
||||
"
|
||||
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
||||
set errorformat+=\\\ %#%f(%l):\ %#%t%[A-z]%#\ %[A-z]%#%n:\ %m
|
||||
|
||||
" Microsoft MSBuild errors
|
||||
"
|
||||
" @note I got this off the Internet and haven't tested it yet.
|
||||
"
|
||||
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
||||
set errorformat+=\\\ %#%f(%l\\,%c):\ %m
|
||||
|
||||
" Microsoft HLSL compiler: fxc.exe
|
||||
"
|
||||
" @note I got this off the Internet and haven't tested it yet.
|
||||
" @todo Add an example
|
||||
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
||||
|
||||
"""""""""""""""""""""""""
|
||||
" Build functions
|
||||
"""""""""""""""""""""""""
|
||||
|
||||
function! HideBuildResultsAndClearErrors()
|
||||
RemoveErrorMarkers
|
||||
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
|
||||
|
@ -1138,9 +1182,23 @@ function! ExecuteRunScript()
|
|||
exec "AsyncRun! -post=call\\ StopRunTask() ./run %"
|
||||
endfunction
|
||||
|
||||
function! Build()
|
||||
let l:extension = tolower(expand('%:e'))
|
||||
if l:extension == "jai"
|
||||
exec "AsyncRun! -save=2 jai %"
|
||||
else
|
||||
exec "AsyncRun! -save=2 ./build* %"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SilentBuild()
|
||||
AsyncStop
|
||||
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() ./build* %"
|
||||
let l:extension = tolower(expand('%:e'))
|
||||
if l:extension == "jai"
|
||||
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() jai %"
|
||||
else
|
||||
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() ./build* %"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Show results window the moment the async job starts
|
||||
|
@ -1157,7 +1215,7 @@ nnoremap <leader>bc :call ToggleBuildResults()<cr>
|
|||
noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
|
||||
|
||||
" Execute build script
|
||||
nnoremap <leader>b :AsyncRun! -save=2 ./build* %<cr>
|
||||
nnoremap <leader>b :call Build()<cr>
|
||||
nnoremap <F8> :call SilentBuild()<cr>
|
||||
|
||||
" Execute run script
|
||||
|
|
Loading…
Reference in New Issue
Block a user