Answers.Body: <h1>use a loop</h1>
  
  <p>If you're a Linux or OS X user then you can use a Bash <em>for loop</em>:</p>
  
  <pre><code>mkdir outputdir
  for f in *.mp4; do ffmpeg -i "$f" -c:v libx264 -vf scale=640:-2 -c:a copy "outputdir/${f%.*}.mp4"; done
  </code></pre>
  
  <p>Maybe a Windows user can add a similar example that works for that OS.</p>
  
  <h1>or simply cram it all in one command</h1>
  
  <pre><code>ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 \
  -map 0 -s 640x480 -c:a copy 1_2.mp4 \
  -map 1 -s 640x480 -c:a copy 2_2.mp4 \
  -map 2 -s 640x480 -c:a copy 3_2.mp4 \
  -map 3 -s 640x480 -c:a copy 4_2.mp4
  </code></pre>
  
  <p>You have to use <a href="http://ffmpeg.org/ffmpeg.html#Advanced-options" rel="nofollow"><code>-map</code></a> otherwise the default <a href="http://ffmpeg.org/ffmpeg.html#Stream-selection" rel="nofollow">stream selection</a> will choose the same input for each output.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-03T21:40:36.190Z
Answers.LastActivityDate: 2015-12-03T21:48:17.493Z
Answers.LastEditDate: 2015-12-03T21:48:17.493Z
Answers.UserDisplayName: llogan
Body: <p>I have to issue a series of commands, all in the form as shown below:</p>
  
  <blockquote>
    <p>ffmpeg -i 1.mp4 -s 640x480 -c:a copy 2.mp4<br>
    ffmpeg -i 2.mp4 -s 640x480 -c:a copy 2_2.mp4<br>
    ffmpeg -i 3.mp4 -s 640x480 -c:a copy 3_2.mp4<br>
    ffmpeg -i 4.mp4 -s 640x480 -c:a copy 4_2.mp4  </p>
  </blockquote>
  
  <p>Please show me how can I issue all commands automatically or do it with one command.</p>
  
Tags: <ffmpeg>
Title: How can i do series command in ffmpeg
UserDisplayName: OYAKHILOME JOSHUA
ThreadText: # How can i do series command in ffmpeg
  
  (Asked by: username_0 on 2015-12-02)
  
  I have to issue a series of commands, all in the form as shown below:
  
  > ffmpeg -i 1.mp4 -s 640x480 -c:a copy 2.mp4  
  > ffmpeg -i 2.mp4 -s 640x480 -c:a copy 2\_2.mp4  
  > ffmpeg -i 3.mp4 -s 640x480 -c:a copy 3\_2.mp4  
  > ffmpeg -i 4.mp4 -s 640x480 -c:a copy 4\_2.mp4
  
  Please show me how can I issue all commands automatically or do it with one command.
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-12-03. Score: 2
  
  # use a loop
  
  If you're a Linux or OS X user then you can use a Bash *for loop*:
  
  ```
  mkdir outputdir
  for f in *.mp4; do ffmpeg -i "$f" -c:v libx264 -vf scale=640:-2 -c:a copy "outputdir/${f%.*}.mp4"; done
  
  ```
  
  Maybe a Windows user can add a similar example that works for that OS.
  
  # or simply cram it all in one command
  
  ```
  ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 \
  -map 0 -s 640x480 -c:a copy 1_2.mp4 \
  -map 1 -s 640x480 -c:a copy 2_2.mp4 \
  -map 2 -s 640x480 -c:a copy 3_2.mp4 \
  -map 3 -s 640x480 -c:a copy 4_2.mp4
  
  ```
  
  You have to use [`-map`](http://ffmpeg.org/ffmpeg.html#Advanced-options) otherwise the default [stream selection](http://ffmpeg.org/ffmpeg.html#Stream-selection) will choose the same input for each output.
  
  
  ---
  
  