The new Java project studies online notes -day13 (d)

2.2 generating m3u8 / ts files 
step ff mpeg generated using m3u8 follows:
first step: first converted to avi video mp4

[AppleScript]  plain text view  Copy the code

?

1

ffmpeg.exe ‐i  lucene.avi ‐c:v libx264 ‐s 1280x720 ‐pix_fmt yuv420p ‐b:a 63k ‐b:v 753k ‐r 18  .\lucene.mp4


Here to talk about the meaning of the parameters, you can probably understand the meaning, no longer explain this expansion of streaming media expertise.
-c: v video encoded as x264, x264 encoding is an open-source coding format of H264.
-s set the resolution -pix_fmt yuv420p: a pixel sampling mode, there are three main ways of sampling, YUV4: 4: 4, YUV4 : 2: 2, YUV4: 2: 0, its role is to flow from the code according to the sampling mode restore each pixel YUV (luminance, color information and information) values. -b setting rate, -b: a and -b: v represent the video bit rate and audio bit rate, -b represents the total bit rate of audio plus video. Rate has a great effect on the quality of a video, the back will be introduced.
-r: frame rate, represents the image frame updates per second, typically greater than 24 coherent with the naked eye without feeling a pause.  
Step two: mp4 generate m3u8

[AppleScript]  plain text view  Copy the code

?

1

ffmpeg.exe ‐i  lucene.avi ‐c:v libx264 ‐s 1280x720 ‐pix_fmt yuv420p ‐b:a 63k ‐b:v 753k ‐r 18  .\lucene.mp4


-hls_time length of each sheet is provided, in seconds
-hls_list_size n: number of fragments saved, saves all set to 0 fragments -hls_segment_ fi lename: file name of the segment,% 05d represents a 5-digit number is generated by the effect of: lucene.mp4 video file generated every 10 seconds ts a file, the last generates a m3u8 file, the file is ts m3u8 index file.

  M3u8 use VLC open files, test playback, VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVD, Audio CD, VCD and various streaming protocols. ( Http://www.videolan.org/ )

 
disposed 2.2.1 coding rate 
rate i.e. bitrate known transmission bit number per second, in units of bps (Bit Per Second), the greater the rate of data transfer rate faster.
Rate calculation formula is: file size (converted into bit) / duration (sec) / 1024 = kbps i.e. one thousand bits of the video transmission, for example, a 1M per second, which is the length of time 10s, it is equal to the bit rate


code rate setting how much can be achieved best by reference is given based on personal experience or refer to some video network station, below is Youku rate of requirements:

[AppleScript]  plain text view  Copy the code

?

1

1*1024*1024*8/10/1024 = 819Kbps



Set to rate how much can be achieved best through personal experience or reference refer to some video network station given figure is Youku bit rate requirements:

 

Guess you like

Origin blog.csdn.net/czbkzmj/article/details/91045969