Author Topic: Split full video into scenes covering the full video at once  (Read 677 times)

this.myself

  • Newbie
  • *
  • Posts: 2
Split full video into scenes covering the full video at once
« on: December 11, 2017, 05:47:19 PM »
My main usage of Avidemux is to split a video into multiple parts / scenes. Now I do this by setting marks with "A" and "B", delete or cut a part, save a part, revert, set "A" and "B" again and so on.

It would be very nice, to just set "split points" or "cut points" throughout the video and then Avidemux would create a new video file for every part between these points (and start and end).

Is there a possibility to achieve this?

Would it be possible to implement it without too much hassle? I am a Software Engineer, I could do it if I find some time.

Example:
Input Video: 90 minutes
Split Point 1: at 15 minutes
Split Point 2: at 30 minutes
Split Point 3: at 60 minutes

Output:
Video 1 from START (00:00) to 00:15,
Video 2 from 00:15 to 00:30,
Video 3 from 00:30 to 60:00 and
Video 4 from 60:00 to END (90:00).

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 5985
Re: Split full video into scenes covering the full video at once
« Reply #1 on: December 12, 2017, 07:15:08 AM »
Perhaps this is a base to continue on?   
[2.6.4] Script for extract parts of large video

this.myself

  • Newbie
  • *
  • Posts: 2
Re: Split full video into scenes covering the full video at once
« Reply #2 on: December 12, 2017, 09:44:20 PM »
Thank you, this is a good hint. It does what I want, just not as user friendly as I thought with a "just click some frames and export" function as I was thinking about. But it does the job and as long as I do not find the time to implement it, it's totally ok.

But the script always crashes when the second part should be saved. It says one of the cut points is not a key frame and then crashes, showing the name of Segment.cpp and then windows needs to kill it. I always choose an I-Frame. Are these not key frames?

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2016
Re: Split full video into scenes covering the full video at once
« Reply #3 on: December 13, 2017, 07:17:12 AM »
Strictly speaking, frames shown as I-frames in Avidemux are IDR frames. The problem might arise from time stamps in the script not exactly matching the I-frame PTS (you can't rely on PTS being precisely a value in milliseconds * 1000).

Instead of this guess exercise one could just look into the related admlog.txt to know which assert is failing. It is probably also better to use the latest nightly (the script would need to be modified for that due to a new MP4 muxer config).

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2016
Re: Split full video into scenes covering the full video at once
« Reply #4 on: December 13, 2017, 12:21:46 PM »
I looks like it can't work with the current state of the scripting API in Avidemux. The interface should expose methods ADM_Composer::setCurrentFramePts and ADM_Composer::getCurrentFramePts to become usable for this purpose.

In my testing, the crash due to markers not matching the exact PTS value of a frame doesn't happen – methinks this was fixed past 2.7.0 release – Avidemux just issues the expected warning about cuts being not on intra.