Difference between revisions of "User:Mjb/FFmpeg"
(new page) |
|||
Line 1: | Line 1: | ||
==Rotate 180 degrees== | ==Rotate 180 degrees== | ||
− | When you hold a camera phone the wrong way, it will just put a | + | When you hold a camera phone the wrong way, it will just put a 180° rotation flag in the metadata, which not all players will support. To rotate the actual video, chain the '''hflip''' and '''vflip''' filters: |
ffmpeg -i ''inputfile'' -vf "vflip,hflip" ''outputfile'' | ffmpeg -i ''inputfile'' -vf "vflip,hflip" ''outputfile'' | ||
Line 16: | Line 16: | ||
* https://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg | * https://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg | ||
* https://stackoverflow.com/questions/15335073/can-i-set-rotation-field-for-a-video-stream-with-ffmpeg | * https://stackoverflow.com/questions/15335073/can-i-set-rotation-field-for-a-video-stream-with-ffmpeg | ||
+ | |||
+ | ==Transcode to a specific frame size & bitrate== | ||
+ | |||
+ | My iPhone records video at 1920x1080. The audio doesn't take up much space at all, but the video is H.264 at about 17 Mbps, so it uses up 125 MB per minute. Here is a way to get it down to a more manageable size and more portable container format, along with the 180° rotation ("vflip,hflip") mentioned above: | ||
+ | |||
+ | ffmpeg.exe -i ''inputfile.mov'' -acodec copy -b:v 2000k -vf "vflip,hflip,scale=1024:-1" ''outputfile.mkv'' | ||
+ | |||
+ | This makes it be about 15 MB/minute: 2 Mbps, 1024 width, -1 means whatever height will preserve the aspect ratio. | ||
+ | |||
+ | Reference: | ||
+ | * https://trac.ffmpeg.org/wiki/FilteringGuide#Scaling |
Revision as of 16:49, 31 January 2014
Rotate 180 degrees
When you hold a camera phone the wrong way, it will just put a 180° rotation flag in the metadata, which not all players will support. To rotate the actual video, chain the hflip and vflip filters:
ffmpeg -i inputfile -vf "vflip,hflip" outputfile
The rotation flag will not be changed when you do this, so you can set it afterward (assumes video is stream # 0):
ffmpeg -i inputfile -c copy -metadata:s:v:0 rotate=0 outputfile
Or you can do both at the same time (untested):
ffmpeg -i inputfile -vf "vflip,hflip" -metadata:s:v:0 rotate=0 outputfile
Reference:
- https://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg
- https://stackoverflow.com/questions/15335073/can-i-set-rotation-field-for-a-video-stream-with-ffmpeg
Transcode to a specific frame size & bitrate
My iPhone records video at 1920x1080. The audio doesn't take up much space at all, but the video is H.264 at about 17 Mbps, so it uses up 125 MB per minute. Here is a way to get it down to a more manageable size and more portable container format, along with the 180° rotation ("vflip,hflip") mentioned above:
ffmpeg.exe -i inputfile.mov -acodec copy -b:v 2000k -vf "vflip,hflip,scale=1024:-1" outputfile.mkv
This makes it be about 15 MB/minute: 2 Mbps, 1024 width, -1 means whatever height will preserve the aspect ratio.
Reference: