1

enter image description hereI'm working on a simple Angular 2 project. Where I've to select a specific part of the video and then download that clipped part in different video formats. Any help in this regards are highly appreciable. Thanks.

1 Answers1

0

It will depend on the specific video format and how it is streamed, but in general a video 'container', e.g. an mp4 file, will contain header information, video, audio, subtitle track data etc, which means you can't simply choose a chunk from the middle of the container file and use this as a separate video.

Assuming your video on the server is a basic mp4 file which is being streamed using basic HTTP streaming, then one approach would to use a library like ffmpeg to create the sub video from the original on the server side, and then download the newly created video from there. The ffmpeg functions will make sure the sub-video has the correct header information etc.

You can, in theory, also do this on the browser as there some Javascript based ffmpeg libraries, but in practice this would probably require you to download the entire video, would be very slow and you may find the actual ffmpeg functionality you require I snot supported in the browser.

If your video on the server is a fragmented mp4 file, using HLS or DASH to stream it then you can use MP4BOX to segment it - see this answer for an example command line:

Mick
  • 24,231
  • 1
  • 54
  • 120