FFMPEG : Trimming Options

Suppose we want to trim from 59 seconds to 66 seconds

if audio is to be retained.

ffmpeg -i outros.mp4 -ss 59 -t 7 yogaOutro.mp4

if audio channel is to be used.

ffmpeg -i outros.mp4 -ss 59 -t 7 -an yogaOutroNoAudio.mp4

With filter_complex

if audio is to be retained.

ffmpeg -i outros.mp4     -filter_complex "[0:v]trim=start=59:end=66,setpts=PTS-STARTPTS [vout];[0:a]atrim=59:66 ,asetpts=PTS-STARTPTS[aout]" -map [vout] -map [aout]  yogaOutro.mp4 -y

if different audio is to be used.

ffmpeg -i outros.mp4   -i outros.mp4   -filter_complex "[0:v]trim=start=59:end=66,setpts=PTS-STARTPTS [vout];[1:a]atrim=59:66 ,asetpts=PTS-STARTPTS[aout]" -map [vout] -map [aout]  yogaOutro.mp4 -y

if no audio is to be used.

ffmpeg -i outros.mp4 -filter_complex "[0:v] trim=start=59:end=66,setpts=PTS-STARTPTS [cut]" -map [cut]  yogaOutroSilent.mp4 -y

if blank audio channel is to be used.

ffmpeg -i outros.mp4   -f lavfi -i anullsrc   -filter_complex "[0:v]trim=start=59:end=66,setpts=PTS-STARTPTS [vout];[1:a]atrim=59:66 ,asetpts=PTS-STARTPTS[aout]" -map [vout] -map [aout]  yogaOutroSilent.mp4 -y

Find if audio channel is present

In Linux

ffprobe -i input.mp4 -show_streams 2>&1 | grep 'Stream #0:1'

In Windows

ffprobe -i input.mp4 -show_streams 2>&1 | findstr "STREAM #0:1"

Output

if there is audio channel, it will be like.

[STREAM]
[/STREAM]
[STREAM]
[/STREAM]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)

if no audio channel, it will be like.

[STREAM]
[/STREAM]