Speed multi part of video 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?
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.