=====================================================
The simplest LIBVLC-based example article list:
The simplest LIBVLC-based example: The simplest LIBVLC-based video player
The simplest LIBVLC-based example: The simplest LIBVLC-based video player (graphical interface version)
The simplest LIBVLC-based example: The simplest LIBVLC-based ejector
=====================================================
This document records the simplest of LIBVLC-based converters. The converter can transcode the local video file and push it to the target streaming media server (or a multicast address).
The simplest LIBVLC-based push-flow device
The code for the ejector is very simple and only uses a few functions:
Libvlc_new (): Create libvlc_instance_t.
Libvlc_vlm_add_broadcast (): Adds a broadcast (broadcast).
Libvlc_vlm_play_media (): Plays the broadcast of the specified name (broadcast).
Libvlc_vlm_stop_media (): Stops the broadcast of the specified name (broadcast).
Libvlc_vlm_release (): Release ibvlc_instance_t.
The input video file for this example is "cuc_ieschool.flv". This flow converter implements:
- Input video transcoding to H.
- Audio transcoding to MP2
- Package format set to Mpeg-ts
- Send to multicast address "udp://233.233.233.233:6666" as UDP
When the program sends a broadcast, a window pops up to display the video that is currently being sent.
Source
/** * Simplest LIBVLC-based ejector * simplest LIBVLC streamer * * Lei hua Lei Xiaohua * [email protected] * Communication University/Digital TV Technology * Communica tion University of china/digital TV technology * http://blog.csdn.net/leixiaohua1020 * * This program is one of the simplest LIBVLC-based push-flow converters. * Suitable for beginners to learn LIBVLC. * * This example are the simplest streamer based on LIBVLC. * Suitable for the beginner of LIBVLC. */#include <Windows.h> #include "vlc/vlc.h" int main (int argc, char **argv) {libvlc_instance_t *vlc;const char *url ;//send File//transcode it. Video codec use x264. Audio codec use Mpga.//mux it-mpegts Format.//and stream it to udp://233.233.233.233:6666/*const char *sout = "#transco De{vcodec=h264,fps=25,venc=x264{preset=ultrafast, "profile=main,tune=zerolatency},vb=512,scale=0.5," "Acodec=mpa,aenc=ffmpeg,ab=64,channels=2}" ": standard{access=udp,mux=ts,dst=233.233.233.2 33:6666} "; *///send and playing at same timeconst char *sout =" #transcode {vcodec=h264,fps=25,venc=x264{preset=ultRafast, "profile=baseline,tune=zerolatency},vb=512," "acodec=mpga,ab=64,channels=2}" ":d uplicate{dst=display,dst=standard{access=udp,mux=ts,dst=233.233.233.233:6666}}"; const Char *media_name = "Lei ' s test";//screen Capture//url = "screen://"; url = "cuc_ieschool.flv"; vlc = libvlc_new (0, NULL); Li Bvlc_vlm_add_broadcast (VLC, media_name, url, sout, 0, NULL, true, false); Libvlc_vlm_play_media (VLC, media_name);//play 30s_sleep (30000); Libvlc_vlm_stop_media (VLC, media_name); Libvlc_vlm_release (VLC); return 0;}
Download
Simplest LIBVLC Example
SourceForge Project home: https://sourceforge.net/projects/simplestlibvlcexample/
cdsn:http://download.csdn.net/detail/leixiaohua1020/8342413
This project is comprised of some sample programs based on LIBVLC. The following sub-programs are included altogether.
Playergui: The simplest LIBVLC-based player-graphical interface version.
Simplest_libvlc_example: The simplest LIBVLC-based player.
Simplest_libvlc_streamer: The simplest LIBVLC-based push-to-flow device.
The simplest LIBVLC-based example: The simplest LIBVLC-based ejector