Elementary stream
An elementary stream (ES) as defined by the MPEG communication protocol is usually the output of an audio or video encoder.
ES contains only one kind of data, e.g. audio, video or closed caption.
An elementary stream is often referred to as "elementary", "data", "audio", or "video" bitstreams or streams.
The format of the elementary stream depends upon the codec or data carried in the stream, but will often carry a common header when packetized into a packetized elementary stream.
- ES流是视频或音频的编码器输出。
- ES只能包含一种类型的数据,视频或音频等。
Elementary stream mean in H.264
If you're using ffmpeg you could use something similar to the following:
ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -vcodec libx264 -f h264
test.264
You'll have to adapt the command line for the file type you're exporting the video from.
This generates a file containing H.264 access units where each access unit consists of one or more NAL units with each NAL unit prefixed with a start code (0x00 0x00 0x00 0x01 or 0x00 0x00 0x01).
You can open the file using a hex editor to take a look at it.
You can also create an H.264 elementary stream file (.264) by using the the H.264 reference encoder from raw YUV input files.
Generally anything in a container (avi or mp4) is not an elementary stream.
The typical extension used for elementary streams is ".264".
The quickest way to double check that a file is an elementary stream is to open the file in a hex editor and look for a start code at the beginning of the file (0x00 0x00 0x00 0x01).
Note that there should be 3 (0x00 0x00 0x01) and 4 (0x00 0x00 0x00 0x01) byte start codes through out the file (before every NAL unit)
- 针对H.264的ES流,保存成文件的后缀名为.264。
- 在容器(如MP4文件)中的内容一般不是ES流。
- H.264的ES流中,每个NALU前缀为0x00 0x00 0x00 0x01 或 0x00 0x00 0x01。
H.264 Elementary stream 示例
-
SPS
以00 00 00 01 67
开头。 -
PPS
以00 00 00 01 68
开头。
00 00 00 01 68 ee 32 c8
-
I帧
以00 00 00 01 65
开头。
- P帧
以
00 00 00 01 41
开头。
ES in live555
localhost:mediaServer Private$ ./live555MediaServer
LIVE555 Media Server
version 0.89 (LIVE555 Streaming Media library version 2016.06.23).
Play streams from this server using the URL
rtsp://192.168.1.102:8554/<filename>
where <filename> is a file present in the current directory.
Each file's type is inferred from its name suffix:
".264" => a H.264 Video Elementary Stream file
".265" => a H.265 Video Elementary Stream file
".aac" => an AAC Audio (ADTS format) file
".ac3" => an AC-3 Audio file
".amr" => an AMR Audio file
".dv" => a DV Video file
".m4e" => a MPEG-4 Video Elementary Stream file
".mkv" => a Matroska audio+video+(optional)subtitles file
".mp3" => a MPEG-1 or 2 Audio file
".mpg" => a MPEG-1 or 2 Program Stream (audio+video) file
".ogg" or ".ogv" or ".opus" => an Ogg audio and/or video file
".ts" => a MPEG Transport Stream file
(a ".tsx" index file - if present - provides server 'trick play' support)
".vob" => a VOB (MPEG-2 video with AC-3 audio) file
".wav" => a WAV Audio file
".webm" => a WebM audio(Vorbis)+video(VP8) file
See http://www.live555.com/mediaServer/ for additional documentation.
(We use port 8000 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)
可见:
** ".264" => a H.264 Video Elementary Stream file**
".265" => a H.265 Video Elementary Stream file
** ".m4e" => a MPEG-4 Video Elementary Stream file**
References:
https://en.wikipedia.org/wiki/Elementary_stream
http://stackoverflow.com/questions/27090114/what-does-elementary-stream-mean-in-terms-of-h264