In our legal system, the general rule is that everything is permitted unless some law says otherwise. Federal and state laws restrict the extent to which conversations may be recorded. The rules regarding photography, including video (with no audio portion) are not nearly as restrictive. In general organizations may set up video recording of their premises without notice to those entering up on the premises except in places like bathrooms, locker rooms, exam rooms, dressing rooms, etc. These are the rules that would apply to recordings in school buildings and grounds other than the classroom. As it turns out, California has a specific law that deals with recording in the classrooms of elementary and secondary schools (junior high/middle school and high school):
The Legislature finds that the use by any person, including a pupil, of any electronic listening or recording device in any classroom of the elementary and secondary schools without the prior consent of the teacher and the principal of the school given to promote an educational purpose disrupts and impairs the teaching process and discipline in the elementary and secondary schools, and such use is prohibited. Any person, other than a pupil, who willfully violates this section shall be guilty of a misdemeanor.
Any pupil violating this section shall be subject to appropriate disciplinary action.
This section shall not be construed as affecting the powers, rights, and liabilities arising from the use of electronic listening or recording devices as provided for by any other provision of law.
Cal. Educ. Code § 51512. Thus, in order to record what goes on in a classroom, the person recording must have the permission of both the principal and the teacher for that classroom. But others, including students, would not have to be told of the recording nor would their consent be needed for it.
As for whether a recording may be used “legally” much matters what use you have in mind. Note that if you want the recording admitted in court, the general rule is that any recording illegally made cannot be used as evidence. Whether a recording made legally may be admitted as evidence depends on a number of things that I won’t get into here.
Note though a California appeals court has held that recordings in the classroom that were made in violation of Education Code § 51512 may be used by the school administration in disciplinary proceedings against teachers:
Evens and United Teachers argue that unless the Board and District are prohibited from viewing the videotape they will accomplish “through the back door what they could not do through the front.” To allow the Board and District to view the videotape would, according to Evens and United Teachers create a dangerous precedent since it would encourage “students or other individuals who may have political or other petty differences with teachers to secretly record them.” Evens and United Teachers conclude that it is “up to the courts to make sure that violators of laws do not get rewarded for their anti-social practices by giving them a forum for individuals to view their tapes.” The problem, of course, is that the Legislature has spoken. Section 51512 simply states that use of an electronic listening or recording device in a classroom is disruptive and impairs the teaching process and discipline in schools. Section 51512 does not state, nor does it imply, that videotapes such as the one made here cannot be used by school officials in reviewing whether a teacher should be disciplined. To the extent Evens and United Teachers contend that Section 51512 should be amended to specifically make such a statement, this is a matter best taken up with the Legislature.
Evens v. Superior Court, 77 Cal. App. 4th 320, 325, 91 Cal. Rptr. 2d 497, 500 (1999)(italics in original).