FFmpeg
Convert to GIF with color table
First pass creates a combined color table into a 16x16 PNG. This also keeps transparency.
ffmpeg -i frame_%04d.png -vf palettegen=reserve_transparent=1 palette.png
ffmpeg -i frame_%04d.png -i palette.png -r 25 -lavfi paletteuse=alpha_threshold=128 -gifflags -offsetting frames.gif
Cutting
ffmpeg -ss "01:23" -i input.mp4 -t "01:00:00" -c:a copy -c:v copy output.mp4
ffmpeg -i input.mp4 -ss "01:23" -t "01:00:00" -c:a copy -c:v copy output.mp4
-ss
: Skips to this position in the input video
If set before the-i
parameter, the skip will be aproximately based on e.g. key frames, after is an exact seek-t
: The amount of time to encode (or copy)
Concatting
Create a file list.txt
with all files to concat in the order you want:
file 'file1.mp4'
file 'file2.mp4'
The execute the command:
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
- Use
-safe 0
to allow relative path names - Use
-c copy
if the formats are compatible - otherwise specify what to convert the output to
2-Pass encoding
ffmpeg -i input.mp4 -b:v 1600k -c:v libx264 -an -pass 1 output_null.mp4
// or just pass it to /dev/null if it exists
ffmpeg -i input.mp4 -b:v 1600k -c:v libx264 -b:a 160k -c:a aac -pass 2 output.mp4
This will create temporary files on 1st pass.
Custom commands
simvalley PW-315.touch (240x240 fix with borders)
ffmpeg.exe -i {input} -vf "scale=240:-1,pad=240:240:0:24" -c:v libxvid {output}
Rip DVD
Needs
libdvdcss
to be installed!!!
Find the title you want by running VLC, go through the menu and then look which one is selected under Playback -> Title and replace $title
with that number. This rips the title from the DVD:
mplayer dvd://$title -dvd-device /dev/sr0 -dumpstream -dumpfile file.vob
Take note of which streams are exported, especially which audio languages in which order.
Then you can convert the exported title.
ffmpeg -i file.vob \
-map 0:v:0 -map 0:a:0 -map 0:a:1 \
-c:v libx264 -c:a aac -b:a 160k -crf 22 \
-metadata:s:a:0 language=deu -metadata:s:a:1 language=eng \
output.mp4
-i file.vob
: The exported title-map 0:v:#
: Include the #-th video stream from first input file (zero-based)-map 0:a:#
: Include the #-th audio stream from first input file (zero-based)-c:v libx264
: The video codec to use for the output-c:a aac
: The audio codec to use for the output-b:a 160k
: The audio bitrate for the output-crf 22
: The constant rate factor (video quality) for the output (the lower the better but slower)-metadata:s:a:# language=???
: Set thelanguage of the #-th mapped audio stream to ???output.mp4
: The output file and its container format via extention