VLC command line to stream/convert/record from an rtsp stream - streaming

I am using Lubuntu linux 18.04LTS, VLC 3.0.8 trying to record via vlc a video stream from a security camera and so far have not had success. I tried using the GUI "Convert" but despite choosing mp4, it seems to only play back as an mp3. Then I thought the command line might work, but I haven't found a clear tutorial in how to set up the right parameters. The closest I've gotten is this, which is:
vlc -vvv rtsp://#192.168.0.xyz:XXXX/videofeed --sout="#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:file{mux=mp4,dst=/media/my/external/hard/disk/yard-01.mp4,no-overwrite}" :no-sout-all :sout-keep
The problem is the file created is not usable/readable. Using Gnome MPV player, I get "Format not recognized." And it doesn't play. Xine seems to play it, but treat it as a silent audio file (guessing at that). When I look at the command line messages, I get a long scroll of "mp4 mux warning: i_length <= 0" which, I am guessing, cannot be good.
I'm the first to admit I don't know much about the options in that line above...just cut them from other folks' posts who said they got this to work. Is there something I can tweak above to make it record video properly? It doesn't have to be mp4, just something decent that will allow me to get a good feed for security purposes.
I should add that the streaming part works fine in VLC. I have a nice feed whenever I want via live streaming. So I know the hardware and access part is fine. It's just the transcoding that I think is going awry.
Any and all help greatly appreciated. Thank you in advance!

Related

how to record the voip call using sipsorcery sdk?

I am using sample programs provided by sipsorcery:
https://github.com/sipsorcery/sipsorcery/tree/master/sipsorcery-softphonev2
What I want to record the call or record the part of one side spoken text, process it, then generate the answer test and speak it back.
What I need right now to process the spoken text. I wanted to record the parts of call and save them to a wav file and generate text from it. but it seems to me that I am doing wrong. I am not able to generate the correct wav file using the provided method of sipsorcery SDK.
I have tried to follow the example on this forum as well, but it didn't work
https://markheath.net/post/how-to-record-and-play-audio-at-same
I expect that this should work using a small temporary wave file at each time the user speaks a sentence and response back again playing back the processed response file.
Any guidance how can I achieve this sense of interception and processing of the call?
Thanks,
Vivek
This example should be pretty close to what you need. It plays the audio (only ulaw support) via the default speaker using NAudio. To record it should be a matter of switching from using NAudio playback to saving to a wav file.

Flowplayer Secure Streaming (via PHP): MP4 videos not Pseudo-Streaming (FLVs do)

I've ran into a problem with MP4 secure pseudo streaming.
First of all, a couple of FACTS for you to get the idea:
I'm using Flowplayer
I have mod_h264_streaming installed and working.
I have successfully added secure streaming plugin (PHP validation) and it's working with pseudo for FLV videos (thanks to mod_h264_streamin, of course).
I'm testing with an MP4 with the moov-atom at the beginning (and the video starts immediately. No pseudo, though).
Now... when flowplayer loads an MP4, the player makes a request like this:
http://mydomain.com/videos/fa3...[security_hash]...46/video.mp4?start=0
Note the ?start=0
When I seek to another part of the video (not yet loaded), the player makes this request:
http://mydomain.com/videos/fa3...[security_hash]...46/video.mp4?start=33.342
Note the ?start=33.342
This results in the video starting again from the beginning, which is the problem.
ADDITIONAL FACT: for MP4 files start is sent (to the PHP script) as the seconds of the timeline where you click on, and for FLVs start is sent as the seek position in Bytes and I think this difference is the main reason of the issue.
My question is:
How do I handle, in my PHP pseudo streaming script, MP4 videos streaming?
Auto-question: Should I use byte ranges headers?
I'm not posting code, as it's not a coding problem, but a conceptual one: let's focus on the idea by now.
Also, all files I'm testing with are well encoded and they are not the problem.
Thanks

Record audio, add effects, then save result to a audio file

I am having trouble doing what the title said. My goal is to be able to add any desired effects to your recording, save the modified audio, then send that to a server.
I have searched the fourms and came across these threads:
viewtopic.php?f=7&t=13029&p=45362&hilit=saving#p45362
viewtopic.php?f=7&t=12660&p=44586&hilit=saving#p44586
viewtopic.php?f=7&t=13178&p=45746&hilit=saving#p45746
After reading those, I see it is possible to save the modified audio, but can it only be saved as a wav? Like I said after it is saved it will be sent to a server, so size is a big deal and wavs are relatively big compared to other formats. Ignoring that fact, I tried to implement FMOD_OUTPUTTYPE_WAVWRITER and I cannot get that to work; are there any good examples of using it? I looked though the examples in the library but I didn't see any..
But the basic structure of the app is to record, turn some switches off and on to see what filters you want, preview it, then press a button "Save" that will save it. What would this save function consist of?
Any help appreciated, thanks.
Using FMOD_OUTPUTTYPE_WAVWRITER is fairly straight forward, you set the type via System::setOutput, specify the output file via System::init extradriverdata. The extradriverdata should be an absolute path to a writable area of the device such as the documents directory. After you have finished playing, call System::release and the file will be complete.
The other option for recording wave data with effects is by creating a custom DSP and connecting it to the channel playing the recorded data. You will then get regular callbacks giving you float data that you must write out to disk yourself. You can find examples of DSPs and writing wav files in the dsp_custom and recordtodisk examples respectively.
Finally note that FMOD doesn't come with the facility to write compressed audio to disk, you will need another API to achieve this goal.
You can save as an AAC file via the ExtAudioFile API.

VLC detecting stream type on command line

Is there a way to dump information about the stream from vlc on command line?
I mean codec used by the stream, bitrate, and all that good stuff without even playing the stream.
Thank you
I'm trying to find out that, too.
The answer is no. Command line of vlc doesn't support that as I know.

Take screenshot of audio stream

Alright, what I need is a command-line application that allows you to take a screenshot of a file's audio stream.
For example it should be run like this:
app.exe "C:/artist-title.mp3" "C:/mp3Stream.jpg"
app.exe "C:/artist-title.wav" "C:/wavStream.jpg"
It only has to be able to capture mp3 streams, other streams are a bonus.
Preferably all audio channels are listed in the image, but if all channels are combined into one mono stream it would work just as good for me.
So, is there such a application out there? So that I don't re-invent the wheel.
If not does anyone have tips on how I should go about writing such a application myself? Preferably in Java. I can handle programming pretty well but I'm not exactly an expert on the MP3/WAV formats.
Why do I need it...? Well, it's more fun to link to a file online with some sort of preview image besides the link. It gives you a hint of the audio character before you listen to it (is it loud? does it look like "bit music"? does it have any parts that are more quiet than others? etc).
Never mind, I wrote my own little application in Java.
It was a piece of cake once I found this excellent guide:
http://codeidol.com/java/swing/Audio/Build-an-Audio-Waveform-Display/
Although you can't download the source from that page (as far as I can tell, though he makes it apparent that you should be able to) he does provide some very useful key lines of code that makes it easy to puzzle together the application.
Adding a little bit of help (easy stuff). You can get a graphics object from doing so:
BufferedImage img = new BufferedImage(500, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D gfx = (Graphics2D) img.getGraphics();
And once you have drawn everything you need on the gfx you can save it to disk just by one line:
ImageIO.write(img, "jpg", new File("waveform.png"));
It's hard to get it to look very good though. Doesn't look as nice as for example Audacity. Guess they have spent more time on it than a few hours though.
The biggest pain about this is however that Java don't support MP3 import. They really should get around to that.
So to get the waveform of MP3s I first convert them into WAV using "javazoom.jl.decoder.Decoder.java", it's on their website. Very easy to use, just give the input path and the output path and it's done.
javazoom dot net (couldn't post more than one "hyperlink" on this website)
The big downside of this is of course that a huuge WAV file has to be created, and woe be unto thee if the MP3 happens to be 15 minutes or so... The WAV will be over 100 MiB (maybe even 200 MiB, haven't found out since I got a Java-out-of-memory-error, even though I gave the VM 512mb).
MP3 support in Java today please. Guess the reason they don't have it is because of copyright issues. Copyright really is slowing man down.
Also take a look at http://www.jsresources.org/
It provides a pretty good FAQ section about everything Audio in Java, and some example applications.