icon robot josef

Video stuff, unsorted

How to resize cheaply

Cheaply regarding quality and low effort.

ffmpeg -i input.mkv -vf scale=$width:$height <encoding-parameters> output.mkv

$width and $height denote the target’s resolution, output.mkv. To only use one dimension and keep the aspect ratio, set the missing resolution scale to -1:

ffmpeg -i input.mkv -vf scale=1024:-1 <encoding-parameters> output.mkv

or

ffmpeg -i input.mkv -vf scale=-1:576 <encoding-parameters> output.mkv

respectively.

Split mkv video by chapters

In case your mkv contains chapter marks

mkvmerge -o output.mkv --split chapters:all input.mkv

The resulting output-001.mkv, output-002.mkv… will keep their srt subtitles in sync.

via

mp4 and webm

Info on your file:

ffmpeg -i input.file.mp4

Video stream:

ffmpeg -i input.file.mp4 -vcodec copy -an output.h264

Audio stream:

ffmpeg -i input.file.mp4 -acodec copy-vn output.aac

Demuxing several mp4 (h264/ aac):

for i in *.mp4; do ffmpeg -i "$i" -vcodec h264 ${i%.*}.h264 -acodec aac ${i%.*}.aac; done

Instant remuxing into mkv container:

ffmpeg -i input.file.mp4 -acodec copy -vcodec copy output.file.mkv

mp4 does not support srt files. They can be added with a transcoding command: -scodec mov_text. Beware, mp4 is a poor choice and hardware support for softsubs is poor also.

ffmpeg -i input.file.mp4 -acodec copy -vcodec copy -scodec mov_text output.file.mkv  

via
via