This is an old revision of the document!
Video TIPS
Getting INFO
avprobe <file>
Convert to webm
ffmpeg -i input.video -threads 4 -b:v 1M -crf 10 output.webm
Repair index
mencoder -idx input.video -ovc copy -oac copy -o output.video
MKV
convert to mkv
mkvmerge -o output.mkv <inputfile>
convert to mkv and downgrade quality
avconv -i <inputfile> -map 0 -c:v libx264 -crf 20 -c:a copy <outfile>.mkv
concatenate all *.mp4 files to output.mkv
mkvmerge -o output.mkv $(echo *.mp4 | sed "s| | +|g")
script
convert files to mkv and downgrade them if greater than specific value
tomkv (chmod +x)
#!/bin/bash OUTDIR=out LIMIT_MBYTE=1500 QUALITY=20 # lower values are better mkdir -p $OUTDIR set -x for f in "$@" do [ -f "$f" ] || continue SIZE=$(stat -c%s "$f") OUTNAME=$OUTDIR/${f%.*}.mkv [ -f "$OUTNAME" ] && ( echo "Skip $OUTNAME"; continue ) if [ $SIZE -gt $(($LIMIT_MBYTE*1000000)) ]; then echo avconv $f avconv -i "$f" -map 0 -c:v libx264 -crf $QUALITY -c:a copy -c:s copy "$OUTNAME" else echo mkvmerge $f mkvmerge "$f" -o "$OUTNAME" fi done
Usage to convert into ./out folder
tomkv file1 file2 ...