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
llogan
  • 87,794
  • 21
  • 166
  • 190

3 Answers3

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
chepner
  • 389,128
  • 51
  • 403
  • 529
  • 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 – Tom Vanwinkel May 24 '20 at 16:34
  • You can run instances of of `ffmpeg` in parallel; there is minimal overhead involved in the actual shell. – chepner May 24 '20 at 16:51
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 
Mark Setchell
  • 146,975
  • 21
  • 182
  • 306
0

Use:

for i in *.mov; do ffmpeg -i "$i" -c copy "${i%.*}.mp4"; done
llogan
  • 87,794
  • 21
  • 166
  • 190