Skip to content

Instantly share code, notes, and snippets.

@paulormart
Last active November 22, 2018 09:07
Show Gist options
  • Save paulormart/6695f6a16f4c36dbdd42e76e30df2b94 to your computer and use it in GitHub Desktop.
Save paulormart/6695f6a16f4c36dbdd42e76e30df2b94 to your computer and use it in GitHub Desktop.

Export without audio and without reencode the file

ffmpeg -i [input_file] -vcodec copy -an [output_file]

Export as mp4 otherwise safari will not be able to stream the file. The qscale 0 directive instructs ffmpeg not to adjust quality of the video during conversion.

ffmpeg -i [input_file.webm] -qscale 0 [output_file.mp4]
  1. Flip video vertically:
ffmpeg -i INPUT -vf vflip -c:a copy OUTPUT
./ffmpeg -i vivani-original.mov -vf vflip -c:a copy vivani-original-vflipped.mov
  1. Flip video horizontally:
ffmpeg -i INPUT -vf hflip -c:a copy OUTPUT
./ffmpeg -i vivani-original.mov -vf hflip -c:a copy vivani-original-hflipped.mov
  1. Flip video vertically and horizontally:
ffmpeg -i INPUT -vf hflip -c:a copy OUTPUT
./ffmpeg -i vivani-original.mov -vf hflip,vflip -c:a copy vivani-original-hvflipped.mov
  1. Rotate 90 degrees clockwise:
ffmpeg -i INPUT -vf transpose=1 -c:a copy OUTPUT
  1. Rotate 90 degrees counterclockwise:
ffmpeg -i vivani-original.mov -c:a copy vivani-original.mp4

Convert.mov to .mp4

ffmpeg -i my-video.mov -vcodec h264 -acodec mp2 my-video.mp4

Preparing mp4 files to HLS stream

Bitstream Filters Formats

ffmpeg -i manuel.mp4 -bsf:v h264_mp4toannexb -codec copy -start_number 0 -hls_time 0 -hls_base_url https://www.domain.com/ ./out/output.m3u8
ffmpeg -i manuel.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 -hls_time 0 -hls_list_size 0 -f hls ./out/640x360.m3u8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment