I made a simple bash script to convert movies from .avi to .mp4 but now I want to do two more things.
- Have the output file have only *.mp4 rather than *.avi.mp4
- Delete the old file after the conversion is completed.
Here is my script.
#!/bin/bash
avconv -i "$1" -c:v libx264 -c:a copy -sn -crf 24 "$1".mp4
${1%.avi}.mp4, where we tell bash to print the contents of$1with the.avisuffix removed, and then append the.mp4suffix.aconv ... && rm "$1", in order to only delete if conversion succeeds, because the&&operator only executes the command that follows it if the previous command succeeds.Final version:
Hope this helps =)