update media object programatically
Media is like any other entity based on ContentEntityBase in Drupal.    

// top of your file
use Drupal\media_entity\Entity\Media;

// in a function
$media = Media::load($id);
// do stuff with $media
$media-&gt;save();


edit:

In a method of a class you would not want to use Media:: but instead use entityTypeManager service to load the entity:

$media = $this-&gt;entityTypeManager-&gt;getStorage('media')-&gt;load($id); where entityTypeManager is injected to your class.