当前位置:网站首页>Multimedia development (1): playing

Multimedia development (1): playing

2020-12-07 14:47:42 Guangzhou Xiaocheng

Areas distinguished from skill differences , Each has its own data structure and process . Want to master an area of expertise , It means understanding its structure and process ( But there are many understandings that can be translated ), however , This doesn't mean that starting with a concept is the best way . Find an entry point , Accomplish a function in a specific field , And then at the right time to do the understanding of the concept of the system , This way, , Is a good way to learn . The most important point , It's an interesting process . That is to say, learning should be driven by problems , If you can learn to teach , That's the best .

There are many knowledge and skills in multimedia , It is easier to get started than to go deep .

“ The media ”, Is the sound 、 Images 、 Text elements , Many elements together are called “ multimedia ”, When these elements are transmitted in streaming protocol, they are called “ Streaming media ”.

In the digital world , hear , Things to see , It's all multimedia , When it comes to multimedia , The easiest function to think of is playing , Leijiacha etc from “ Play ” Function of the , Let's implement this first , Try to avoid conceptual issues .

FFmpeg, This assembly , It is often used in multimedia skills , This assembly is used to implement the playback function .

How does this work FFmpeg To play .

FFmpeg Inside the assembly , There's a program called ffplay( player ), It provides the ability to play .

(1)ffplay Installation

I'm using mac The computer , stay mac Installation on ffplay The solution is simple :

brew install ffmpeg --with-sdl2 --with-rtmpdump

Be careful , If you find this install Commands no longer support with-sdl2 or rtmpdump, Then install it yourself , That is, adjust to :

brew install sdl2
brew install rtmpdump
brew install ffmpeg

After successful installation , You can put the ffplay Run it , Run as a command line :
ffplay Version information for 1
ffplay Version information for 2
Because I installed a ffplay, And then use FFmpeg The source code and compiled a ffplay, So there are two different versions .

(2) Play

Installed on ffplay Player case , Broadcasting is a simple matter .

such as :

ffplay "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8"
ffplay ~/Desktop/1.mp4

ffplay Can play audio and video files on the network , You can also play local files . As long as there is a path ( or url), You can use it ffplay To play .

That's in addition to local resources , You can find some interesting ones url To play? ?

You can generally search on the Internet , Or I could just grab the address .

For example pc to “ Cool dog live ”, Open up a studio , And then use Charles Grab the bag ( Or other tools ), You can see the address :
 Broadcast address

Change to a studio ( This is on demand ):
 Broadcast address

Another example , A live address of Huya is like this :
 Broadcast address

perhaps , Search the Internet for some available addresses , such as ( It may be overdue , Available at press time ):

CCTV1 hd : http://ivi.bupt.edu.cn/hls/cc...
CCTV3 hd : http://ivi.bupt.edu.cn/hls/cc...
CCTV5+ hd : http://ivi.bupt.edu.cn/hls/cc...
CCTV6 hd : http://ivi.bupt.edu.cn/hls/cc...

Let's see ffplay The effect when playing :

television :
 Live experience 1

studio :
 Live experience 2

In use ffplay When the play , There are some shortcuts to use , such as :

q -- sign out
p/ Space -- Pause
w -- Switch on the cover 、 Waveform and energy diagram
f -- Full screen
s -- Frame by frame display
Left and right 、 Up and down direction -- Fast forward or backward

Okay , To sum up , The article introduces FFmpeg Medium ffplay Use , Happy to complete the playback function , There's basically no complicated concept involved .see you.

版权声明
本文为[Guangzhou Xiaocheng]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/202012071446585083.html