How to trim HLS or MEPG-DASH video using FFmpeg?

I have one HLS video URL and I want to trim the video from 30 seconds to 2 minutes and 30 seconds, how do I do that using FFmpeg?

Hey Annie!

Basically, FFmpeg provides a two-parameter for trimming the video.
• -ss option allows you to seek video at a particular position it takes value in HH:MM: SS format or in absolute seconds.
• -t options allow you to read a specified number of seconds from the video, taking value in the same format as “ -ss “. So with the combination of both -ss and -t you can trim an HLS or MPEG-DASH video.

You can use the following FFmpeg commands to cut the video.

Let’s assume that I want to trim a video to the first 30 seconds and there is only one video and audio stream in the video.
ffmpeg -i <HLS/MPEG-DASH Video URL> -ss 0 -t 30 -c copy -bsf:a aac_adtstoasc -f mp4 output.mp4

This is all to trim videos and this is how you can merge those videos using ffmpeg.
I hope this may resolve your issue!

Thankyou :smiley:

Great! It works for me.