You can change the CRF and audio bitrate parameters to vary the output quality. For high quality video and audio, read the x264 Encoding Guide and the AAC Encoding Guide, respectively.įor example: ffmpeg -ss -i in.mp4 -t -c:v libx264 -crf 23 -c:a aac -b:a 192k out.mp4 If you leave out the -c copy option, ffmpeg will automatically re-encode the output video and audio according to the format you chose. Sometimes, using -c copy leads to output files that some players cannot process (they'll show a black frame or have audio-video sync errors). ![]() This won't harm the quality and make the command run within seconds.įor more info on seeking, see How to cut a video, with re-encoding c copy copies the first video, audio, and subtitle bitstream from the input to the output file without re-encoding them. If we instead use -copyts, and we want the part from 5–35 seconds, we should use: ffmpeg -copyts -ss 5 -i in.mp4 -to 35 -map 0 -c copy out.mp4įinally, we've used the -c copy option. The output will still be 30 seconds long. This achieves the same thing as above, since the timestamps get reset to 0 after seeking 5 seconds in the input. Or: ffmpeg -ss 5 -i in.mp4 -to 30 -map 0 -c copy out.mp4 In other words, you get the input video's part from 5–35 seconds. This seeks forward in the input by 5 seconds and generates a 30 second long output file. This makes -to behave more intuitively.įor example: ffmpeg -ss 5 -i in.mp4 -t 30 -map 0 -c copy out.mp4 If you want -ss to not reset the timestamp to 0, the -copyts option can be used. You have to understand that normally, -ss resets the timestamps of the input video after the cut point to 0, so by default it does not matter if you use -t or -to.
0 Comments
Leave a Reply. |