2

I'd like to save my entire avconv command with options so that I can reuse it without typing it in every time. I would still need to specify the input and output filenames. How do I do this? I'm on Ubuntu.

1
  • 1
    put the command in a text file – Wutnaut Jun 19 '14 at 20:37
2

Make a script:

#!/bin/bash
avconv <your options here> $1 $2

$1 and $2 are arguments that will be passed to avconv. The idea is to replace input file by $1 and output file by $2. Then you'll run your script with ./script.sh input.mp4 output.mkv for example.

Example:

#!/bin/bash
avconv -f alsa -i pulse -f video4linux2 -channel 1 -s 768x576 -i /dev/video0 -deinterlace -c:v mpeg2video -b:v 4000k -b:a 192k $1

And I run it like:

./record.sh video.mpg

video.mpg is passed through $1 to avconv.

2
  • Do I need to place the $1 and $2 in the place they would appear in the command? like 'avconv -i $1 <options> $2' – MikeJerome Jun 19 '14 at 20:49
  • 1
    @MikeJerome yes, in the place where the filenames should be. – Cornelius Jun 19 '14 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.