FFmpeg bacic command
ffmpeg -i "4G_LargeSize.mp4" -vcodec libx265 -crf 28 output.mp4
To reduce a video's size with ffmpe : Since 2013 a video format much better than H.264 is widely available, namely H.265 (better in that it compresses more for the same quality, or gives higher quality for the same size). To use it, replace the libx264 codec with libx265, and push the compression lever further by increasing the CRF value - add, say, 4 or 6, since a reasonable range for H.265 may be 24 to 30. Note that lower CRF values correspond to higher bitrates, and hence produce higher quality videos.
ffmpeg -i input.webm output.mp4
ffmpeg -i input.mp4 output.mkv
ffmpeg -i input.mp3 output.ogg
Basic convertion : FFmpeg automatically knows what video and audio it can support and will convert the your specific format file.
ffmpeg -i input.mp3 -c:a libvorbis output.ogg
ffmpeg -i input.mp4 -c:v vp9 -c:a libvorbis output.mkv
ffmpeg -codecs
- Convert the audio by encoding the audio codec "libvorbis"
- Convert the video by encoding the video codec "v9" & audio "libvorbis"
- The command ffmpeg -codecs will print every codec FFmpeg knows about.
ffmpeg -i input.webm -c:v copy -c:a flac output.mkv
This command copies the video stream from input.webm into output.mkv and encodes the Vorbis audio stream into a FLAC. The -c flag is really powerful.
ffmpeg -i input.mkv -c:a copy -s hd720 output.mkv
ffmpeg -i input.mkv -c:a copy -s 1280x720 output.mkv
Adjust the dimensions of your video using FFmpeg
ffmpeg -i input.mkv -c:av copy -ss 00:01:00 -t 10 output.mkv
This will copy the video and audio streams (-c:av copy) but will trim the video. The -t option sets the cut duration to be 10 seconds and the -ss option sets the start point of the video for trimming, in this case at one minute (00:01:00)
ffmpeg -i input.mkv -vn audio_only.mp3
Extract the audio only from video
ffmpeg -i input.mkv output.gif
This command creates a GIF of the same dimensions as the input file.
ffmpeg -i input.mp4 -ss 00:23:32 -to 00:24:32 -c:v copy -c:a copy output.mp4
Cut your own clip.
f## Merge Video and Audio (same duration)
ffmpeg -i video.mp4 -i audio.mp4 -c:v copy -map 0:v -map 1:a -y output.mp4
## Merge subtitle words into video
ffmpeg -i input.mp4 -vf subtitles=input.vtt output.mp4
## To reduce a video's size with ffmpeg H265 compression :
ffmpeg -i "4G_LargeSize.mp4" -vcodec libx265 -crf 28 "output.mp4"
## Convert Video to specific resolution
ffmpeg -i input.mp4 -s 960x540 -c:a copy output_960x540.mp4
## Convert Video to hd480 (852x480) hd720 (1280x720) hd1080 (1980x1080) 2k (2048x1080) 4k (4096x2160)
ffmpeg -i input.mp4 -s hd720 output_720p.mp4
## Rotation
ffmpeg -i in.mov -vf "transpose=1" out.mov
## Add Subtitle to the Video Using the subtitles Filter
ffmpeg -i input.mp4 -vf subtitles=subtitle.srt output_srt.mp4
##Convert the Subtitle to ASS Format
ffmpeg -i subtitle.srt subtitle.ass
vi subtitle.ass
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
ffmpeg -i input.mp4 -vf ass=subtitle.ass output_ass.mp4
Server is hosted by Alanstudio
Linux Operating System
Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.
|