Compare commits

...

2 Commits

Author SHA1 Message Date
pta 5e428f503a Add shell function for fixing invalid timestamps. Fix typos. 2023-12-29 13:34:06 -05:00
pta b622011260 Add link to ffmpeg's VP9 encoding guide 2023-12-29 13:07:27 -05:00
2 changed files with 15 additions and 6 deletions

View File

@ -5,12 +5,13 @@ videos, and, to your clipboard, copying ffmpeg command lines for making webms.
Also, some shell aliases and functions for:
- making audioless copies of webms
- concatenating video files that use web-compatible codecs
- concatenating video files that use webm-compatible codecs
- converting youtube live stream URLs into their chat window URLs and placing in clipboard
- taking screenshots with ffmpeg
- watching Japanese news channels
- watching Japanese tv channels
- toggling sideways xorg display
- concatenating Kindle cloud reader page fragment into a single image
- taking a mov3.co stream cache dumped video with invalid timestamps and make a copy with valid timestamps
* Key bindings
** Generally used
- ~l~: set ab-loop points; see mpv man page
@ -86,6 +87,7 @@ mpv 'https://music.youtube.com/playlist?list=OLAK5uy_nscRtcc2KZcydiVY7q0feukzm17
#+end_src
You can even skip songs forwards and backwards like you can with local files using the < and > keys.
* Research
- [[https://trac.ffmpeg.org/wiki/Encode/VP9][FFmpeg and VP9 Encoding Guide]]
- [[https://superuser.com/questions/681885/how-can-i-remove-multiple-segments-from-a-video-using-ffmpeg][how to use ffmpeg's trim filter]]
- [[https://stackoverflow.com/questions/9168058/how-to-dump-a-table-to-console][how to dump a lua table to console]]
- [[https://github.com/mpv-player/mpv/blob/master/player/lua/assdraw.lua][mpv's assdraw module]]

View File

@ -39,7 +39,6 @@ rma() {
local N=$( basename $1 | sed -e 's/.webm$//' -e 's/.mkv$//' -e "s/$/${FPS}/").webm
ffmpeg -an -i $1 -c copy $FPSOPT /tmp/$N
}
# Converts youtube stream url into the chat-only url
ytchat() {
local URL
@ -52,7 +51,6 @@ ytchat() {
xclip -se c <<<"$URL"
echo $URL
}
# concats 2 or more webms specified in /tmp/a
#
# learned from this
@ -81,7 +79,6 @@ concatvid() {
rm -f concatvidlist
}
# Mostly used to concatenate together the 4 pieces of a 2 page spread, or 2 pieces of a
# single page, from kindle book fragment jpegs saved from the web inspector's "Application"
# tab.
@ -102,7 +99,6 @@ concatpics() {
fi
sxiv ${OUTPUT}.*
}
# Toggle rotation of the desktop between sideways and upright.
togglevertical() {
# select the first connected monitor's status line
@ -117,3 +113,14 @@ togglevertical() {
xrandr --output $SCREENNAME --rotate normal
fi
}
# Fix broken timestamps on cache dumps from streams with invalid timestamps
# https://www.reddit.com/r/ffmpeg/comments/quq4kf/recreation_of_timestamps_without_reencoding/?rdt=61001
fixtimestamps () {
local BASE=$(basename $1 .mkv)
local INTERV="/tmp/${BASE}.h264"
local INTERA="/tmp/${BASE}.aac"
# works without the make non negative options, but the first frame might have a negative timestamp, see link
ffmpeg -y -hide_banner -i file:$1 -c:v copy -f h264 $INTERV -c:a copy $INTERA &&
ffmpeg -y -hide_banner -r 25 -i $INTERV -i $INTERA -c copy -avoid_negative_ts make_zero /tmp/${BASE}.mp4
rm $INTERV $INTERA
}