Command line for video, audio, speed

Li recently watched a suspense drama of love, "see you", seen friends have been estimated five hundred of a "last dance" brainwashed, very top.

Since I was double speed to watch videos, play songs which is twice the speed. After leaving open the video, I downloaded the song lyrics, I feel very different, the overall pace slowed, not brainwashing, do not meet the new era of fast-paced life, in short, that did not taste of. So I want this song speed playback, he took out a magic FFmpeg .

Change the audio rate

Change the audio rate easiest way is to directly adjust the audio sampling rate, but at the same time, this approach will change the audio sound. The general use of acoustic resampling, and other methods to achieve the difference. Magnification adjustment scope of the following command line is 0.5 to 2.

ffmpeg -i input.mkv -filter:a "atempo=2.0" -vn output.mkv

If you want fast, then again, you need to change the command, strung together by more atempo filters to get around this limitation.

ffmpeg -i input.mkv -filter:a "atempo=2.0,atempo=2.0" -vn output.mkv

Change the video rate

Change the video playback rate is achieved by modifying a timestamp indicative of the video (PTS). As a simple example, if the timestamp is displayed at two successive frames 1 and 2, we want to accelerate the speed of the video, then the two timestamps need to 0.5 and 1, respectively. Therefore, we must put them multiplied by 0.5.

ffmpeg -i input.mkv -r 16 -filter:v "setpts=0.5*PTS" output.mkv

When the video acceleration, in order not dropped frames, may be utilized fps -r parameter specifies the output.

In general, the required video speed video with audio speed is also achieved by filtration FIG mixing the following command,

ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mkv

Want speed playback of video, music, friends may wish to try it ~

references

Published 135 original articles · won praise 490 · views 60000 +

Guess you like

Origin blog.csdn.net/lyc44813418/article/details/104221478