Skip to content

Instantly share code, notes, and snippets.

2024-05-29T00:00:11.4896598Z Current runner version: '2.316.1'
2024-05-29T00:00:11.4924051Z ##[group]Operating System
2024-05-29T00:00:11.4924803Z Ubuntu
2024-05-29T00:00:11.4925130Z 22.04.4
2024-05-29T00:00:11.4925452Z LTS
2024-05-29T00:00:11.4925855Z ##[endgroup]
2024-05-29T00:00:11.4926216Z ##[group]Runner Image
2024-05-29T00:00:11.4926642Z Image: ubuntu-22.04
2024-05-29T00:00:11.4927107Z Version: 20240526.1.0
2024-05-29T00:00:11.4928109Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20240526.1/images/ubuntu/Ubuntu2204-Readme.md
@shinchiro
shinchiro / encode.bat
Last active May 17, 2024 16:54
My one-drag encode using CLI
@echo OFF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Copyright (C) 2017-2019 miniencodes.nl :::
:: :::
:: Author: Shinchiro :::
:: :::
:: Purpose: To re-encode anime to small size with little effort, without GUI. :::
:: WARNING: DON'T PUT THIS SCRIPT IN SAME FOLDER AS INPUT FILE, IT WILL OVERWRITE THE INPUT FILE. :::
:: The lock file is needed to force only one encoding at same
@shinchiro
shinchiro / HardsubWithFFmpeg.txt
Created December 14, 2016 04:03
How to hardsub subtitle with FFmpeg
::
:: This demonstrate on how to hardsub embeded subtitle and downscale video to 360p with only FFmpeg. Ensure FFmpeg is compiled with --enable-libass
ffmpeg -hide_banner -i "D:\oh\test\input.mkv" -vf "subtitles='D\:\\oh\\test\\input.mkv'",scale=-1:360:flags=spline -c:v libx264 -preset ultrafast output.mp4
::Character ':', '\' need to be escaped if present in input's path
:: Escape both characters with sed.
echo "D\:\\oh\\test\\input.mkv" | sed "s,\\,\\\\,g;s,:,\\:,g" >>name
set /p modified=< name
@shinchiro
shinchiro / packages.txt
Last active December 22, 2022 04:39
Missing Cygwin/MSYS2 packages
1. Install re2c
git clone --depth 1 https://github.com/skvadrik/re2c.git
./autogen.sh
./configure --prefix=/usr
make && make install
2. Install ninja
git clone --depth 1 https://github.com/ninja-build/ninja.git
./configure.py --bootstrap
mv ninja.exe /usr/bin
#Encode HDR video from Samsung:
* Encode and crop 100px from top
ffmpeg.exe -hide_banner -i input -vf scale=-2:480:flags=spline,crop=out_h=in_h-80:y=in_h-80 -an -c:v libx264 -pix_fmt yuv420p -preset veryslow -tune film out.mpv
ffmpeg.exe -hide_banner -i input -vf scale=-2:1080:flags=spline -c:v libx264 -pix_fmt yuv420p -preset veryslow -tune film -crf 18 -c:a aac -b:a 192k out.mp4
*Test encode first frame pic
ffmpeg.exe -hide_banner -i input.mp4 -vf scale=-1:360:flags=spline,zscale=transfer=linear:npl=100,format=gbrpf32le,zscale=primaries=bt709,tonemap=hable:desat=0,zscale=transfer=bt709:matrix=bt709:range=limited,format=yuv420p -vframes 1 output.png
ffmpeg.exe -hide_banner -i input.mp4 -vf scale=-1:720:flags=spline,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -map 0 -c copy -c:v libx264 -pix_fmt yuv420p -preset medium -tune film -crf 20 -c:a copy output.mp4
@shinchiro
shinchiro / patch.bat
Last active May 29, 2020 22:13
Creating xdelta patch easy way.
@echo OFF
:: How to use:
:: 1. Put xdelta3.exe in C:\
:: 2. Put old_file and new_file in any folder but must in same directory
:: 3. run with cmd: patch.bat old_file.mkv new_file.mkv mypatch
:: 4. patch now in 'xdelta' folder
set xdelta3="C:\xdelta3.exe"
set patch_dir=%~dp1\xdelta
call :Createxdelta %1 %2 %3
@shinchiro
shinchiro / git_tricks.txt
Last active April 25, 2020 04:03
Git's trick
1. Clone specific branch
git clone --single-branch -b new_branch git_url
2. Remove/clean git history log
git pull --depth 1
git gc --aggressive --prune=now
3. Export commit as patch
git format-patch -1
@shinchiro
shinchiro / make_x265.sh
Last active April 6, 2020 18:02
Script for building x265
#!/bin/sh
# This script will be put outside of x265's repo folder, side by side.
# Clone x265 repo first before running this script: hg clone https://bitbucket.org/multicoreware/x265
# Tell our build toolchain folder.
# If built with MSYS2, there's no need for this. Also '-DCMAKE_TOOLCHAIN_FILE' command should be removed.
export PATH="/home/shinchiro/build/build64/install/bin:$PATH"
export CXXFLAGS='-march=znver1'
@shinchiro
shinchiro / rename.bat
Last active January 7, 2019 10:03
mkvpropedit's usage
@echo OFF
set mkvpropedit="D:\mkvtoolnix\mkvpropedit.exe"
for %%A in (%*) do (
::%mkvpropedit% "%%~fA" --delete-attachment name:"Impress BT.ttf"
::%mkvpropedit% "%%~fA" --chapters "%%~nA_chapter.xml"
:: Comment should be placed above.
::
:: This will select first video/subtitle tracks to rename name and make first subtitle as default.
:: Adding fonts to the mkv.
%mkvpropedit% "%%~fA" --edit track:v1 --set name="[LowPower-Raws]" --set language=jpn ^
Good reference:
https://gist.github.com/miguelfrde/5dde43aa08b076106b9e
http://tech.memoryimprintstudio.com/dual-boot-installation-of-arch-linux-with-preinstalled-windows-10-with-encryption/
https://wiki.archlinux.org/index.php/GRUB#Windows_installed_in_UEFI-GPT_Mode_menu_entry
http://valleycat.org/linux/arch-usb.html?i=1
#boot live usb or cd
fdisk -l (find your drive names)
lsblk
cfdisk /dev/sda (assuming sda is your HDD)