<p>Daisychain the commands, so</p>

<pre><code>ffmpeg -ss 04:53 -i ./07.mkv -t 3 -c:v libx264 -crf 18 -filter:v "setpts=PTS-STARTPTS, crop=960:720, scale=480:360" -an -sws_flags lanczos -fflags +genpts 07-alexFlex.mp4 -ss 04:53 -i ./07.mkv -t 3 07-alexFlex.mp3 
</code></pre>

CC BY-SA 3.0
2015-11-14T05:57:50.283Z
Is there any way to set variables so that the file names could be copied? Like 07-alexFlex.
Harry
CC BY-SA 3.0
2015-11-14T06:01:38.860Z
Sure, with simple shell scripting. It's been years since I used Linux but bash scripts should work. See https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html - I'm sure someone will come along and provide the specific script for your current use case.
Gyan
CC BY-SA 3.0
2015-11-14T05:35:38.747Z
2015-11-14T05:35:38.747Z
Gyan
<p>I'm trying to get ffmpeg to output separate audio and video files in 1 command.</p>

<p>Here are the 2 commands I have:</p>

<pre><code>ffmpeg -ss 04:53 -i ./07.mkv -t 3 -c:v libx264 -crf 18 -filter:v "setpts=PTS-STARTPTS, crop=960:720, scale=480:360" -an -sws_flags lanczos -fflags +genpts 07-alexFlex.mp4
ffmpeg -ss 04:53 -i ./07.mkv -t 3 07-alexFlex.mp3
</code></pre>

<p>Is there a way to get it in 1 command? Ideally both the audio and video files would share the same name automatically without me changing it twice in both commands. Thanks.</p>

<ffmpeg>
ffmpeg audio video separate files 1 command
Harry
# ffmpeg audio video separate files 1 command

(Asked by: username_0 on 2015-11-14)

I'm trying to get ffmpeg to output separate audio and video files in 1 command.
Here are the 2 commands I have:
ffmpeg -ss 04:53 -i ./07.mkv -t 3 -c:v libx264 -crf 18 -filter:v "setpts=PTS-STARTPTS, crop=960:720, scale=480:360" -an -sws_flags lanczos -fflags +genpts 07-alexFlex.mp4
ffmpeg -ss 04:53 -i ./07.mkv -t 3 07-alexFlex.mp3

Is there a way to get it in 1 command? Ideally both the audio and video files would share the same name automatically without me changing it twice in both commands. Thanks.

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2015-11-14. Score: 1 | Accepted answer

Daisychain the commands, so
ffmpeg -ss 04:53 -i ./07.mkv -t 3 -c:v libx264 -crf 18 -filter:v "setpts=PTS-STARTPTS, crop=960:720, scale=480:360" -an -sws_flags lanczos -fflags +genpts 07-alexFlex.mp4 -ss 04:53 -i ./07.mkv -t 3 07-alexFlex.mp3

> **Comments:**
> **username_0**: Is there any way to set variables so that the file names could be copied? Like 07-alexFlex.  
> **username_1**: Sure, with simple shell scripting. It's been years since I used Linux but bash scripts should work. See https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html - I'm sure someone will come along and provide the specific script for your current use case.  

---

