Android Save Live Video Stream to Storage
Posted: 31 May 2019 12:03
Hi
I'm trying to save a live video stream to storage in Android App using libvlc.
I can do it on PC with command line and it work fine, I record the file and can view it afterwards.
But in the app the file records, it's only 151B big which is probably empty and if I try to open it I get message "Cannot play this video format"
My question is, is it possible to record to storage in Android with libvlc?
Here is the code I've tried. Any suggestions would help
I'm trying to save a live video stream to storage in Android App using libvlc.
I can do it on PC with command line and it work fine, I record the file and can view it afterwards.
But in the app the file records, it's only 151B big which is probably empty and if I try to open it I get message "Cannot play this video format"
My question is, is it possible to record to storage in Android with libvlc?
Here is the code I've tried. Any suggestions would help
Code: Select all
This work for PC command line:
c:\program files (x86)\videolan\vlc vlc rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov --sout=#transcode{vcodec=h264}:std{access=file,dst='c:\aaa\temp.mp4'}
This DON'T work for Android libvlc
var currentDirectory = "/storage/emulated/0/dcim/";
var destination = Path.Combine(currentDirectory, "record2.mp4");
media.AddOption(":sout=#file{dst=" + destination + "}");
Attempt 1: media.AddOption(":sout=#transcode{vcodec=h264}:std{access=file,dst=" + destination + "}");
Attempt 2: media.AddOption(":sout=#transcode{vcodec=mp1v, vb=1024, acodec=mpga, ab=128}:std{access=file, mux=mpeg1, dst=" + destination + "}");
Attempt 3: media.AddOption(":sout=#transcode{vcodec=mp1v}:std{access=file, mux=ps, dst=" + destination + "}");
Attempt 4: media.AddOption(":sout:record:dst:prefix=" + destination + "}");
Attempt 5: media.AddOption(":sout=#stream_out_duplicate{dst=std{access=file,mux=ps,dst=" + destination + "}}");
Attempt 6: media.AddOption(":sout=#transcode{vcodec=mp1v}:std{access=file,mux=ps,dst=" + destination + "}");
Attempt 7: media.AddOption("sout=#std{access=file,dst=" + destination + "}");