Page 1 of 1

video problem to playing on android phone

Posted: 28 Feb 2013 03:12
by omar-vlc
I tried to build a streaming server on Windows to receive multimedia data from **.m3u8 on the network and then stream it out with rtsp.
The browser on android phone played with video and audio if I did it with VLC.
But the browser played with only audio and no video (black screen) if I did it with demo code of libvlc from wiki.
I don't know the difference between the two mode.
Demo code is as follows:

Code: Select all

// vlc2stream.cpp : Defines the entry point for the console application. #include "stdafx.h" #include <conio.h> #include <vlc/vlc.h> #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) { libvlc_instance_t * inst; libvlc_media_player_t *mp; libvlc_media_t *m; libvlc_log_t *log; /* Load the VLC engine */ inst = libvlc_new (0, NULL); // logging log = libvlc_log_open (inst); libvlc_set_log_verbosity (inst, 2); unsigned int level = libvlc_get_log_verbosity (inst); printf ("vlc log verbosity level = %d\n", level); /* Create a new item */ m = libvlc_media_new_path (inst, "http://192.168.1.186:1000/601.m3u8"); // media option const char *options[]= { ":sout=#transcode{acodec=mp4a,ab=32,channels=2,samplerate=44100,vcodec=h264,vb=350,fps=15,scale=1}", ":sout=#standard{mux=mp4}", ":sout=#duplicate{dst=rtp{sdp=rtsp://:8554/601},dst=display}", ":sout-keep" }; for (int i = 0; i < sizeof(options) / sizeof(options[0]); i++) libvlc_media_add_option (m, options[i]); /* Create a media player playing environement */ mp = libvlc_media_player_new_from_media (m); /* No need to keep the media now */ libvlc_media_release (m); #if 0 /* This is a non working code that show how to hooks into a window, * if we have a window around */ libvlc_media_player_set_xdrawable (mp, xdrawable); /* or on windows */ libvlc_media_player_set_hwnd (mp, hwnd); /* or on mac os */ libvlc_media_player_set_nsobject (mp, view); #endif /* play the media_player */ libvlc_media_player_play (mp); while (!kbhit()) Sleep (100); /* Let it play a bit */ /* Stop playing */ libvlc_media_player_stop (mp); /* Free the media_player */ libvlc_media_player_release (mp); libvlc_release (inst); printf ("message in log = %d\n", libvlc_log_count (log)); system("pause"); return 0; }
I think problem comes from the variable options[] in the code which is based on the demo, the document to vlc command and
vlc software. Streaming with vlc software will generate a stream output string on the dialog "option setup".
I tried a lot of commands in the options[] but no result.
Anyone can help me? Thanks in advance.