Answers.Body: <p>Use</p>
  
  <p><code>ffmpeg -ss %startTime% -t %duration% -i %input% -filter_complex "[0:v]split=2[c1][c2];[c1]crop=%size%:%position%[c1];[c2]crop=200:110:6558:106[c2];[c1][c2]overlay=%pixFrmLeft%:%pixFrmTop%" {your encoding options} %input%_Converted.mp4</code></p>
  
  <p>Note that <code>-framerate 8</code> is an input option for certain file formats. For an output at 8 fps, use <code>-r 8</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-19T18:26:14.743Z
Answers.Text: Thank you, that worked great.  I did have to modify it slightly by putting `-ss %startTime% -t %duration%` at the end with my encoding options.  If I didn't do this, it seems like it was doing unnecessary work, or taking a very long time. I cleaning it all up by making %encopts% and included the time options there as well.
Answers.UserDisplayName: ditch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-19T18:39:13.490Z
Answers.Text: Share the log. It's the precise opposite - `-ss` before input skips unnecessary processing.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-19T22:24:28.557Z
Answers.Text: Ok, here are two logs. -ss before: [link](https://pastebin.com/5GD1resg) and -ss after: [link](https://pastebin.com/U1QzCCvF)
Answers.UserDisplayName: ditch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-20T05:36:47.283Z
Answers.Text: This is due to the pixel format of the input and a quirk in how ffmpeg processes it when input seek is set. Upgrade to latest ffmpeg and check.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-19T04:50:43.217Z
Answers.LastActivityDate: 2019-06-19T04:50:43.217Z
Answers.UserDisplayName: Gyan
Answers.Body: <p>I'd like to offer a version similar to Gyan's, but makes things easier to think about and makes the individual ffmpeg command more readable.</p>
  
  <p>You have a single file, but want to use ffmpeg to crop one part of it differently from another part of it. I find the easiest way to do multiple things on a single file is to mark them as different inputs.</p>
  
  <pre><code>set input1=yourFile.mp4
  set input2=yourFile.mp4
  
  ffmpeg -ss %startTime1% -t %duration1% -i %input1% \
         -ss %startTime2% -t %duration2% -i %input2% \
            filter_complex "[0]crop=%size1%[v1];[1]crop%size2%[v2];\
            [v1][v2]overlay=%pixFrmLeft%:%pixFrmTop%" \
         %commands% %input%_Converted.mp4
  </code></pre>
  
  <p>Gyan does this with the <code>[0:v]split=2[c1][c2]</code> filter, which may be easy to track for now, but in instances where you have more files and want to process more than 2 parts each, creating the list of your inputs (though some are actually the same file) ahead of time is probably the best place to start to help keep you organized and on track.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-20T18:36:50.947Z
Answers.LastActivityDate: 2019-06-20T18:36:50.947Z
Answers.UserDisplayName: user3643
Body: <p>I'm currently using a couple commands to 1- output two files with cropped regions, and 2- overlay the 2 files back into a single file.</p>
  
  <p>I would like to be able to merge this all into out command and have a single output if this would speed up the process.</p>
  
  <p>Here are my current commands (I'm using this inside a batch file, please excuse the variables):</p>
  
  <p>1.This takes the input file and creates 2 output files cropped at different regions.</p>
  
  <pre><code>ffmpeg -i %input% -filter_complex "[0:v]crop=%size%:%position%[out1];[0:v]crop=200:110:6558:106[out2]" -map "[out1]" -f mp4 -ss %startTime% -t %duration% -rtbufsize 100M -framerate 8 -c:v libx264 -qmin 35 -qmax 35 -b:v 50k -preset ultrafast -movflags +faststart tmp -map "[out2]" -f mp4 -ss %startTime% -t %duration% -rtbufsize 100M -framerate 8 -c:v libx264 -qmin 35 -qmax 35 -b:v 50k -preset ultrafast -movflags +faststart tmpclock
  </code></pre>
  
  <p>2.This takes the two ouput files from the previous command and overlays them into the final file.</p>
  
  <pre><code>ffmpeg -i tmp -i tmpclock -filter_complex "[0:v][1:v]overlay=%pixFrmLeft%:%pixFrmTop%" -rtbufsize 100M -framerate 8 -c:v libx264 -qmin 35 -qmax 35 -b:v 50k -preset ultrafast -movflags +faststart -f mp4 %input%_Converted.mp4
  </code></pre>
  
Tags: <video><ffmpeg>
Title: FFMPEG single input file, crop to multiple streams, then overlay back into one output file?
UserDisplayName: ditch
ThreadText: # FFMPEG single input file, crop to multiple streams, then overlay back into one output file?
  
  (Asked by: username_0 on 2019-06-18)
  
  I'm currently using a couple commands to 1- output two files with cropped regions, and 2- overlay the 2 files back into a single file.
  
  I would like to be able to merge this all into out command and have a single output if this would speed up the process.
  
  Here are my current commands (I'm using this inside a batch file, please excuse the variables):
  
  1.This takes the input file and creates 2 output files cropped at different regions.
  
  ```
  ffmpeg -i %input% -filter_complex "[0:v]crop=%size%:%position%[out1];[0:v]crop=200:110:6558:106[out2]" -map "[out1]" -f mp4 -ss %startTime% -t %duration% -rtbufsize 100M -framerate 8 -c:v libx264 -qmin 35 -qmax 35 -b:v 50k -preset ultrafast -movflags +faststart tmp -map "[out2]" -f mp4 -ss %startTime% -t %duration% -rtbufsize 100M -framerate 8 -c:v libx264 -qmin 35 -qmax 35 -b:v 50k -preset ultrafast -movflags +faststart tmpclock
  
  ```
  
  2.This takes the two ouput files from the previous command and overlays them into the final file.
  
  ```
  ffmpeg -i tmp -i tmpclock -filter_complex "[0:v][1:v]overlay=%pixFrmLeft%:%pixFrmTop%" -rtbufsize 100M -framerate 8 -c:v libx264 -qmin 35 -qmax 35 -b:v 50k -preset ultrafast -movflags +faststart -f mp4 %input%_Converted.mp4
  
  ```
  
  **Tags:** video, ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-06-19. Score: 1
  
  Use
  
  `ffmpeg -ss %startTime% -t %duration% -i %input% -filter_complex "[0:v]split=2[c1][c2];[c1]crop=%size%:%position%[c1];[c2]crop=200:110:6558:106[c2];[c1][c2]overlay=%pixFrmLeft%:%pixFrmTop%" {your encoding options} %input%_Converted.mp4`
  
  Note that `-framerate 8` is an input option for certain file formats. For an output at 8 fps, use `-r 8`.
  
  > **Comments:**
  > **username_0**: Thank you, that worked great.  I did have to modify it slightly by putting `-ss %startTime% -t %duration%` at the end with my encoding options.  If I didn't do this, it seems like it was doing unnecessary work, or taking a very long time. I cleaning it all up by making %encopts% and included the time options there as well.  
  > **username_1**: Share the log. It's the precise opposite - `-ss` before input skips unnecessary processing.  
  > **username_0**: Ok, here are two logs. -ss before: [link](https://pastebin.com/5GD1resg) and -ss after: [link](https://pastebin.com/U1QzCCvF)  
  > **username_1**: This is due to the pixel format of the input and a quirk in how ffmpeg processes it when input seek is set. Upgrade to latest ffmpeg and check.  
  
  ---
  
  ### Answer by username_2 on 2019-06-20. Score: 0
  
  I'd like to offer a version similar to username_1's, but makes things easier to think about and makes the individual ffmpeg command more readable.
  
  You have a single file, but want to use ffmpeg to crop one part of it differently from another part of it. I find the easiest way to do multiple things on a single file is to mark them as different inputs.
  
  ```
  set input1=yourFile.mp4
  set input2=yourFile.mp4
  
  ffmpeg -ss %startTime1% -t %duration1% -i %input1% \
         -ss %startTime2% -t %duration2% -i %input2% \
            filter_complex "[0]crop=%size1%[v1];[1]crop%size2%[v2];\
            [v1][v2]overlay=%pixFrmLeft%:%pixFrmTop%" \
         %commands% %input%_Converted.mp4
  
  ```
  
  username_1 does this with the `[0:v]split=2[c1][c2]` filter, which may be easy to track for now, but in instances where you have more files and want to process more than 2 parts each, creating the list of your inputs (though some are actually the same file) ahead of time is probably the best place to start to help keep you organized and on track.
  
  
  ---
  
  