Answers.Body: <p><a href="https://ffmpeg.org" rel="nofollow">FFMPEG</a> can do it, with a bit of shell scripting. Here's how you could do it using Powershell on Windows:</p>
  
  <pre><code>$vidLength = &lt;the length of your video in seconds&gt;
  $vstart = 0;
  $c = 0;
  while ($start -lt $vidlength){
    ffmpeg -ss $vstart -t 180 -i inputvid.mp4 -c:v v210 -c:a pcms16le ("output_{0:0000}.avi" -f $c);
    $vstart += 180;
    $c++;
  }
  </code></pre>
  
  <p>What I'm doing is using a loop to control the ffmpeg command line video program. <code>$vstart</code> is a variable that sets the start time of each video segment, <code>$c</code> is a counter that will be used to number the files. </p>
  
  <p>The ffmpeg command works by using the <code>-ss</code> command which seeks to the given time in the input, and the <code>-t</code> command which sets the duration to encode - both numbers are in seconds. <code>inputvid.mp4</code> is the name of your input video. the <code>-c:v</code> command sets the video codec to v210 which is lossless uncompressed. This will create very large files. Hours of v210 video will run into terrabytes of storage. You might want to use another codec, possibly a lossly one, if so you mightwant to consider using libx264 to encode as h.264. In which case the ffmpeg line would look like:</p>
  
  <pre><code>fmpeg -ss $i -t 180 -i inputvid.mp4 -crf 0 -c:a pcms16le ("output_{0:0000}.mp4" -f $c);
  </code></pre>
  
  <p>here the <code>-crf</code> command is basically like your compression setting. You can wind it down to 0 -> lossless / big files or as high as 31 -> crappy / small files. 20 is a sane value for good quality viewing copies. The <code>-c:a</code> command is the audio codec, in this case uncompressed. If you don't want audio you can replace this with <code>-an</code>.</p>
  
  <p>the output name of the files is set with the expression <code>("output_{0:0000}.avi" -f $c)</code> this uses powershell string formatting to produce files named <strong>output_0000.avi, output_0001.avi…`</strong>. The number of zeros after the colon sets how many leading zeros appear in the file name.</p>
  
  <p>The loop continues, adding 180 (3 minutes in seconds) to <code>$vstart</code> every time, and updating the counter, until it reaches the end of the file. </p>
  
  <p>If you want to get ffmpeg for Windows, I suggest downloading it from <a href="http://ffmpeg.zeranoe.com/" rel="nofollow">here</a>, it's a lot easier than building it yourself.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-02T13:37:56.000Z
Answers.Text: If the OP simply wants to break the whole file into contiguous 3 min segments, then `-segment_time 180 -f segment part%02d.mp4` will do it in one command. But I'm not sure if that's what the OP wanted.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-02T21:44:22.917Z
Answers.Text: Didn't know about the -segment command. Thanks for that.
Answers.UserDisplayName: stib
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-13T23:17:54.587Z
Answers.Text: @stib edit your answer to include a -segment_time option. That's useful for others
Answers.UserDisplayName: paulzag
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-02T00:38:52.820Z
Answers.LastActivityDate: 2016-01-02T00:38:52.820Z
Answers.UserDisplayName: stib
Body: <p>I have a large .mp4 file (many hours long) and I want to split it into many 3 minute clips. How do I do that? Doing it manually with an editing software would take ages. Is there any automatic way to do it WITHOUT losing quality? Maybe there is a video editing software with this option? I use Windows.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-29T15:30:34.103Z
Comments.Text: Can I ask why you are trying to accomplish this?  There may be an easier way to accomplish your end goal.
Comments.UserDisplayName: AJ Henderson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-02T15:48:45.640Z
Comments.Text: There's nothing like what you're looking for. Hire an assistant editor, do it yourself, or reconsider your approach.
Comments.UserDisplayName: CyanideBaby
Tags: <editing>
Title: How to automatically divide a large video file into smaller clips?
UserDisplayName: user8016
ThreadText: # How to automatically divide a large video file into smaller clips?
  
  (Asked by: username_0 on 2014-12-27)
  
  I have a large .mp4 file (many hours long) and I want to split it into many 3 minute clips. How do I do that? Doing it manually with an editing software would take ages. Is there any automatic way to do it WITHOUT losing quality? Maybe there is a video editing software with this option? I use Windows.
  
  **Tags:** editing
  
  > **Comments:**
  > **username_1**: Can I ask why you are trying to accomplish this?  There may be an easier way to accomplish your end goal.  
  > **username_2**: There's nothing like what you're looking for. Hire an assistant editor, do it yourself, or reconsider your approach.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2016-01-02. Score: 2
  
  [FFMPEG](https://ffmpeg.org) can do it, with a bit of shell scripting. Here's how you could do it using Powershell on Windows:
  
  ```
  $vidLength = <the length of your video in seconds>
  $vstart = 0;
  $c = 0;
  while ($start -lt $vidlength){
    ffmpeg -ss $vstart -t 180 -i inputvid.mp4 -c:v v210 -c:a pcms16le ("output_{0:0000}.avi" -f $c);
    $vstart += 180;
    $c++;
  }
  
  ```
  
  What I'm doing is using a loop to control the ffmpeg command line video program. `$vstart` is a variable that sets the start time of each video segment, `$c` is a counter that will be used to number the files.
  
  The ffmpeg command works by using the `-ss` command which seeks to the given time in the input, and the `-t` command which sets the duration to encode - both numbers are in seconds. `inputvid.mp4` is the name of your input video. the `-c:v` command sets the video codec to v210 which is lossless uncompressed. This will create very large files. Hours of v210 video will run into terrabytes of storage. You might want to use another codec, possibly a lossly one, if so you mightwant to consider using libx264 to encode as h.264. In which case the ffmpeg line would look like:
  
  ```
  fmpeg -ss $i -t 180 -i inputvid.mp4 -crf 0 -c:a pcms16le ("output_{0:0000}.mp4" -f $c);
  
  ```
  
  here the `-crf` command is basically like your compression setting. You can wind it down to 0 -> lossless / big files or as high as 31 -> crappy / small files. 20 is a sane value for good quality viewing copies. The `-c:a` command is the audio codec, in this case uncompressed. If you don't want audio you can replace this with `-an`.
  
  the output name of the files is set with the expression `("output_{0:0000}.avi" -f $c)` this uses powershell string formatting to produce files named **output\_0000.avi, output\_0001.avi…`**. The number of zeros after the colon sets how many leading zeros appear in the file name.
  
  The loop continues, adding 180 (3 minutes in seconds) to `$vstart` every time, and updating the counter, until it reaches the end of the file.
  
  If you want to get ffmpeg for Windows, I suggest downloading it from [here](http://ffmpeg.zeranoe.com/), it's a lot easier than building it yourself.
  
  > **Comments:**
  > **username_4**: If the OP simply wants to break the whole file into contiguous 3 min segments, then `-segment_time 180 -f segment part%02d.mp4` will do it in one command. But I'm not sure if that's what the OP wanted.  
  > **username_3**: Didn't know about the -segment command. Thanks for that.  
  > **username_5**: @username_3 edit your answer to include a -segment_time option. That's useful for others  
  
  ---
  
  