<p>Use</p>

<p><code>-filter_complex [0:v]trim=0:12,setpts=(PTS-STARTPTS)[sv];[0:a]atrim=0:12,asetpts=(PTS-STARTPTS)[sa];[0:v]trim=12:50,setpts=0.50*(PTS-STARTPTS)[v0];[0:a]atrim=12:50,asetpts=(PTS-STARTPTS),atempo=2.00[a0];[0:v]trim=50:57,setpts=(PTS-STARTPTS)[ev];[0:a]atrim=50:57,asetpts=(PTS-STARTPTS)[ea];[sv][sa][v0][a0][ev][ea]concat=n=3:v=1:a=1</code></p>

<p>concat filter expects all inputs to start from 0, so each instance of PTS should be replaced with PTS-STARTPTS.</p>

CC BY-SA 4.0
2019-06-11T09:54:29.027Z
2019-06-11T09:54:29.027Z
Gyan
<p>I try speed up a part of video but when completed, the output has the wrong duration video, and it contain some freeze frames. My command:</p>

<pre><code>ffmpeg -i /storage/emulated/0/Screen_Recorder/ScreenRecord/Audio_VD_1560242359654.mp4 -preset ultrafast \
  -filter_complex \
     [0:v]trim=0:12,setpts=PTS[sv]; \
     [0:a]atrim=0:12,asetpts=PTS[sa]; \
     [0:v]trim=12:50,setpts=0.50*(PTS)[v0]; \
     [0:a]atrim=12:50,atempo=2.00[a0]; \
     [0:v]trim=50:57,setpts=PTS[ev]; \
     [0:a]atrim=50:57,asetpts=PTS[ea]; \
     [sv][sa][v0][a0][ev][ea]concat=n=3:v=1:a=1 \
  -profile:v baseline -c:a aac \
  /storage/emulated/0/Screen_Recorder/ScreenRecord/Speed_VD_1560242925087.mp4
</code></pre>

<p>and when I try <code>atrim</code> audio, and merge it to video if trim form more than zero frame before of video after trim can't play. How can I fix it?</p>

<ffmpeg><android>
Speed multi part of video
van nguyen
# Speed multi part of video

(Asked by: username_0 on 2019-06-11)

I try speed up a part of video but when completed, the output has the wrong duration video, and it contain some freeze frames. My command:
ffmpeg -i /storage/emulated/0/Screen_Recorder/ScreenRecord/Audio_VD_1560242359654.mp4 -preset ultrafast \
  -filter_complex \
     [0:v]trim=0:12,setpts=PTS[sv]; \
     [0:a]atrim=0:12,asetpts=PTS[sa]; \
     [0:v]trim=12:50,setpts=0.50*(PTS)[v0]; \
     [0:a]atrim=12:50,atempo=2.00[a0]; \
     [0:v]trim=50:57,setpts=PTS[ev]; \
     [0:a]atrim=50:57,asetpts=PTS[ea]; \
     [sv][sa][v0][a0][ev][ea]concat=n=3:v=1:a=1 \
  -profile:v baseline -c:a aac \
  /storage/emulated/0/Screen_Recorder/ScreenRecord/Speed_VD_1560242925087.mp4

and when I try atrim audio, and merge it to video if trim form more than zero frame before of video after trim can't play. How can I fix it?

**Tags:** ffmpeg, android


---

## 1 answers

### Answer by username_1 on 2019-06-11. Score: 2

Use

`-filter_complex [0:v]trim=0:12,setpts=(PTS-STARTPTS)[sv];[0:a]atrim=0:12,asetpts=(PTS-STARTPTS)[sa];[0:v]trim=12:50,setpts=0.50*(PTS-STARTPTS)[v0];[0:a]atrim=12:50,asetpts=(PTS-STARTPTS),atempo=2.00[a0];[0:v]trim=50:57,setpts=(PTS-STARTPTS)[ev];[0:a]atrim=50:57,asetpts=(PTS-STARTPTS)[ea];[sv][sa][v0][a0][ev][ea]concat=n=3:v=1:a=1`

concat filter expects all inputs to start from 0, so each instance of PTS should be replaced with PTS-STARTPTS.


---

