Skip to content

Instantly share code, notes, and snippets.

@chk1
Last active November 15, 2019 00:09
Show Gist options
  • Save chk1/d2dc2268a7f7c84f1182cf40958ad334 to your computer and use it in GitHub Desktop.
Save chk1/d2dc2268a7f7c84f1182cf40958ad334 to your computer and use it in GitHub Desktop.
Assorted ffmpeg commands for doing Mapillary things

Assorted ffmpeg commands for doing Mapillary things

ffmpeg version N-94423-ga0c1970781 on Windows 10 1809

Combine video files

Create a file list.txt like this (the text "file " before each filename is required):

file first.mp4
file second.mp4

Then run

ffmpeg -f concat -i list.txt -c copy -an output.mp4

Sound is removed (-an).

Rotate 180°

ffmpeg -i in.mp4 -vf "transpose=2,transpose=2" out.mp4

Rotate 180° and raise gamma, AMD GPU accelerated:

ffmpeg -i in.mp4 -vf "transpose=2,transpose=2,eq=gamma=2.0" -c:v h264_amf -quality:v balanced -b:v 15M output.mp4

Using -c:v h264_amf raises performance from 0.5x to 2.75x transcoding speeds (tested on Intel i5-6500, 16GB RAM, AMD RX570, Windows 10 Pro). One caveat, output bitrate -b:v has to be specified, otherwise it will use a very low bitrate by default (15M for video recorded on a SJCAM M10 seems fine).

Cut/Copy parts from a video

First method: Start at 30 seconds into the video and cut 10 seconds (output will be 00:30min to 00:40min from the original)

ffmpeg -ss 00:00:30.0 -i input.mp4 -c copy -t 00:00:10.0 output.mp4

Second method (I forgot what this does exactly)

ffmpeg -ss 30 -i input.mp4 -c copy -t 10 output.mp4

Cut with rotate

ffmpeg -ss 00:01:50.0 -i INPUT.MOV -vf "transpose=2,transpose=2,eq=gamma=1.1" -c:v h264_amf -quality:v balanced -b:v 15M -t 00:01:20.0 OUTPUT.MP4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment