2

ok i have this and it works but it's slow

for i in *.mov;
  do name=`echo "$i" | cut -d'.' -f1`
  echo "$name"
  ffmpeg -i "$i" "${name}.mp4"
done

I want it to convert with these ffmpeg options

ffmpeg -i movie.mov -vcodec copy -acodec copy out.mp4

3 Answers 3

2

Parameter expansion is sufficient; you don't need pipelines involving cut.

for i in *.mov; do
    name=${i%%.mov}  # i=foo.mov => name=foo
    ffmpeg -i "$i" "$name.mp4"
done
Sign up to request clarification or add additional context in comments.

2 Comments

Ok thanks! But it stil slow and I read that if "-vcodec copy -acodec" you use it's going to convert much faster. I want to import in premiere
You can run instances of of ffmpeg in parallel; there is minimal overhead involved in the actual shell.
2

Untested, but you should be able to do them in parallel with GNU Parallel if it's too slow and you have a multicore CPU:

parallel ffmpeg -i {} -vcodec copy -acodec copy {.}.mp4 ::: *.mov

If you want to see what it would do first, without actually doing anything:

parallel --dry-run ffmpeg -i {} -vcodec copy -acodec copy {.}.mp4 ::: *.mov

Note: On macOS, install these two packages simply with homebrew using:

brew install ffmpeg
brew install parallel 

Comments

0

Use:

for i in *.mov; do ffmpeg -i "$i" -c copy "${i%.*}.mp4"; done

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.