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

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

Related

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

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!

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.

Thumbnail generation from video with filestack / filepicker.io

I have some videos and I want to make just 1 thumbnail by video.
I'm using https://www.filestack.com/docs/video-transformations
I've been looking at the documentation and can't find a way to do that without creating a lot of extra files I don't need.
The files are on S3 any hint, workaround or ideas welcome :)
The Filestack method for generating thumbnails for a video is by running a transcode video call. What you can do is tell it to only process a small clip, like 5 seconds or less. If you aren't using webhooks, then you can get the results by making the same request again once the file has completed processing, and the second request will send back all the information that would have been included in the webhook.
Please see the section regarding Video webhooks: https://www.filestack.com/docs/video-transformations

Restream a stream with VLC in real-time

How do I accomplish real-time video re-streaming with VLC (cli on linux) to an m3u8 playlist?
I currently have a piece of code, but it doesn't work correctly.
["cvlc","-v",url,"--drop-late-frames","--skip-frames","--sout","#std{access=livehttp{seglen=1,delsegs=false,numsegs=5, index=/var/www/x/test.m3u8, index-url=http://hello.com/_x/test-########.ts}, mux=ts{use-key-frames}, dst=/var/www/xxx/test-########.ts}}"
The code above for some reason waits 3-10 seconds to generate new .ts files - that should be done in real-time. What command line arguments should I use to correct that problem?
m3u8 is a fragmented format. It means the manifest can not be updated until the fragment is complete (no partial fragments) Because we can not time travel, we must wait for all the frames of the fragment. 3 seconds in your case.

Streaming and playing an MP3 stream. .mp3 URL format

I used the sample code from http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html. it runs OK with default URL. But when I replace with my URL "http://dl.mp3.kapsule.info/fsfsdfdsfdserwrwq3/fc90613208cc3f16ae6d6ba05d21880c/4b5244f0/b/7e/b7e80afa18d06fdd3dd9f9fa44b51fc0.mp3?filename=Every-Day-I-Love-You.mp3", this app shows an message as "Audio not Found". But when I put my URL on Address Bar of Web Browser, I can download this .mp3 file.
really, I can't understand why it is?
pleased tell me!
Thank you very much
My guess would be that the app is designed to play a MP3 encoded audio stream with no limit in length (which is different from your ordinary music file). To set this up, you need a streaming server on the client side.
I think you can find out for sure by trying with a different radio station that transmits in MP3. If that works, it's most likely that your app doesn't like your file.
You should, as Vivek recommends, also try using a simpler download URL for your file, in case the App gets confused by the URL's length and/or structure.
As mentioned, this is due to the URL of the file. The AudioStreamer code specifically checks for the extension of the file and tries to figure out the audio type based on that. If you change that logic to handle your custom URLs, it will start working
So to point you in the right direction: open AudioStreamer.m and look for the references of
hintForFileExtension:
This function returns the type of file based on the extension. If you know the file type won't change (always mp3), the quick and dirty solution is to always assign mp3 type without any logic... like this:
err = AudioFileStreamOpen(self, MyPropertyListenerProc, MyPacketsProc, kAudioFileMP3Type, &audioFileStream);
Note: I've put kAudioFileMP3Type constant instead of calculated value
PS yes, it does work with static mp3 files, even though it's designed for streams and hence misses some of the functionality one would expect from a player that plays a static file on the server (caching, prefetching, proper seeking)
Thats because the default url directly points to a file in the webserver, whereas the the url you've mentioned is a HTTP (POST/GET) operation, which the application may not be designed to handle.
I suspect that your URL is one-time-use. When I try to visit it, I see 408 - Request Timeout.
Many links on mass file sharing websites are like this. If you could download the file directly, you wouldn't sit through a page of ads and premium account offers.
Try again with a file on a normal website, like this one.