Answers.Body: <p>Use ss/to as input options. This seeks at the demuxer stage, which is much faster.</p>
  
  <pre><code>ffmpeg -ss 00:22:23.345 -to 00:22:25.846 -i input.mp4 ...
  </code></pre>
  
  <p>You'll need a very recent build of ffmpeg (> Nov 19 2017)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T15:48:25.713Z
Answers.Text: I have already, should I move them before input file as parameter to executable?
Answers.UserDisplayName: tanaydin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T15:51:04.747Z
Answers.Text: -ss must be before the input file to be applied at the read-stage like the example shows
Answers.UserDisplayName: sebix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T15:53:24.963Z
Answers.Text: I'll try to build with recent source... Current ffmpeg under ubuntu is not accepting like this.
Answers.UserDisplayName: tanaydin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T16:02:15.773Z
Answers.Text: `-ss` as demuxer option is old, but `-to` wasn't implemented till the date stated.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T16:26:09.480Z
Answers.Text: can't make it working with ffmpe3 
  Option to (record or transcode stop time) cannot be applied to input url input.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
  Error parsing options for input file input.mp4.
  Error opening input files: Invalid argument
Answers.UserDisplayName: tanaydin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T16:31:39.157Z
Answers.Text: Use the git version from https://www.johnvansickle.com/ffmpeg/
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T15:21:21.073Z
Answers.LastActivityDate: 2018-01-04T15:21:21.073Z
Answers.UserDisplayName: Gyan
Body: <p>For the project that I'm working on I have to cut some parts of same video with some subtitles. So I made a bash file that executes multiple ffmpeg commands like this.</p>
  
  <pre><code>ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='1.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:00:45.674 -to 00:00:50.093 -async 1 ./out/1.mp4
  
  ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='2.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:00:49.344 -to 00:00:52.971 -async 1 ./out/2.mp4
  </code></pre>
  
  <p>but it fast for first times (start) of the input file, it gets slower if I want to start seeking from middle or near end of input. So it gets nearly 7-8 minutes for 22. minute of the input file...</p>
  
  <pre><code>ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='226.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:22:23.345 -to 00:22:25.846 -async 1 ./out/226.mp4
  </code></pre>
  
  <p>Anybody knows better way to do that?
  Can I do that without seeking file each time? (Because it seems this is a seeking problem to me....)</p>
  
Tags: <ffmpeg><mp4><subtitles><linux>
Title: ffmpeg cut same video to multiple pieces
UserDisplayName: tanaydin
ThreadText: # ffmpeg cut same video to multiple pieces
  
  (Asked by: username_0 on 2018-01-04)
  
  For the project that I'm working on I have to cut some parts of same video with some subtitles. So I made a bash file that executes multiple ffmpeg commands like this.
  
  ```
  ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='1.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:00:45.674 -to 00:00:50.093 -async 1 ./out/1.mp4
  
  ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='2.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:00:49.344 -to 00:00:52.971 -async 1 ./out/2.mp4
  
  ```
  
  but it fast for first times (start) of the input file, it gets slower if I want to start seeking from middle or near end of input. So it gets nearly 7-8 minutes for 22. minute of the input file...
  
  ```
  ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='226.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:22:23.345 -to 00:22:25.846 -async 1 ./out/226.mp4
  
  ```
  
  Anybody knows better way to do that?
  Can I do that without seeking file each time? (Because it seems this is a seeking problem to me....)
  
  **Tags:** ffmpeg, mp4, subtitles, linux
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-04. Score: 2 | Accepted answer
  
  Use ss/to as input options. This seeks at the demuxer stage, which is much faster.
  
  ```
  ffmpeg -ss 00:22:23.345 -to 00:22:25.846 -i input.mp4 ...
  
  ```
  
  You'll need a very recent build of ffmpeg (> Nov 19 2017)
  
  > **Comments:**
  > **username_0**: I have already, should I move them before input file as parameter to executable?  
  > **username_2**: -ss must be before the input file to be applied at the read-stage like the example shows  
  > **username_0**: I'll try to build with recent source... Current ffmpeg under ubuntu is not accepting like this.  
  > **username_1**: `-ss` as demuxer option is old, but `-to` wasn't implemented till the date stated.  
  > **username_0**: can't make it working with ffmpe3  Option to (record or transcode stop time) cannot be applied to input url input.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for input file input.mp4. Error opening input files: Invalid argument  
  > **username_1**: Use the git version from https://www.johnvansickle.com/ffmpeg/  
  
  ---
  
  