How to trim a video?

조회 수: 36 (최근 30일)
Nut
Nut 2017년 6월 23일
댓글: Nut 2017년 6월 26일
Hi,
I have a color video of about 10 minutes, and it also has an audio track. I have to trim it in order to extract the central 3 minutes.
I also need to avoid loss of quality (no compression) and to keep the corresponding audio.
Please, could anyone help me with an example code?
Thank you so much.

채택된 답변

Walter Roberson
Walter Roberson 2017년 6월 23일
Vision.VideoFileReader is the only input routine that can currently handle audio and video combined, and Vision.VideoFileWriter is the only output routine that can currently handle audio and video combined.
The basic mechanism for trimming with them is to open the input, read and discard frames until you get to the point that you want to keep, and then start reading and writing the output.
Unfortunately the reader has no timecode information available, so if your input file is variable frame rate, there is no way to tell how far you are into the file other than frame number.
  댓글 수: 1
Nut
Nut 2017년 6월 26일
These tools are very useful for me and currently they are enough to approach my issue. Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by