Page 1 of 1

Player on Panel is OK but no sound when recorded

Posted: 02 Feb 2024 05:02
by docnao
C++ builder program...

I'm writing simple VLCPlayer on panel1. It worked fine using following code. And using "libvlc_media_add_option" worked for recording to file.
But this file was video only, i.e. no sound stream. I did something wrong around "mux=mp4" or some other set-up?
Incoming sound stream should be someting like g726. Playback is fine with sound.

Code: Select all

void __fastcall TForm1::Button1Click(TObject *Sender) { libvlc_instance_t* instance = libvlc_new(0, NULL); libvlc_media_t* VlcMedia; VlcMedia = libvlc_media_new_location(instance,"rtsp://yourid:yourpassword@192.168.0.253:554/nphMpeg4/g726-640x480"); media_player = libvlc_media_player_new_from_media(VlcMedia); libvlc_media_add_option(VlcMedia,":sout=#duplicate{dst=display,dst=std{access=file,mux=mp4,dst=test.mp4}"); // no sound libvlc_media_release(VlcMedia); libvlc_media_player_set_hwnd(media_player,Panel2->Handle); libvlc_media_player_play(media_player); } //---------------------------------------------------------------------------

Re: Player on Panel is OK but no sound when recorded

Posted: 07 Feb 2024 06:09
by docnao
adding suitable acodec option, it worked finally:

libvlc_media_add_option(VlcMedia,":sout=#transcode{vcodec=mp4v,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=display,dst=std{access=file,mux=mp4,dst=test.mp4}");