Q:

Rename Folders after first file inside that folder using OSX Terminal

I have a bunch of folders that all have the same name or iterating numbers...like Material 01, Material 02, Material 181 etc. 
Inside there are lots of videofiles who got the right name.  I need to rename the folder to have the same name as the first file inside that folder (sorted by name)

A:

Mac terminal is usually using bash, so something like that should do the trick:
Inside your directory where you have your folders: Put that in a file called rename.sh and then type bash rename.sh and hit enter:
#!  /bin/bash

for dir in Material*; do

  while read -rd ''; do
    newname=$(basename -- "${REPLY%.*}") 
    break
  done < <(find "$dir" -maxdepth 1 -not -name '.*'  -type f -print0 | sort -z)

  echo "dir:${dir} new:${newname}"
  mv -n "$dir" "$newname"
done

Assuming that:

every first video has a different filename
that by first you mean the alphabetically first.  

Note: The folder will be named according to the filename without its extension.  But if you'd like to add also the extension to the new name of the folder, you can substitute the first line in the while-loop by newname=$(basename -- "$REPLY")
This solution also ignores hidden files using -not -name '.*',  and is able to handle filenames including newlines.  But in my opinion, it is generally a bad idea to use newlines in filenames.