Does anyone have an example of playing audio (rtmp) using VLCKit - beatsmusic

I get my url from the audio endpoint, location and resource in tow, but when I drop the audio into a VLCMediaPlayer/VLCMedia object it fails. So then I was just trying to get the URL to play in the standard VLC Media Player, no such luck.
However, if I use rtmpdump I can at lest see something is there with the following:
rtmpdump -r <api.location> -y <api.resource>
I'm only using rtmpdump to see if I even get any data at all, if I change the structure of the call to:
rtmpdump -r <api.location> + '/' + <api.resource>
it will fail.
This test makes be think the actual media url is not just + '/' + and I am formatting the url incorrectly for VLCKit playback, or in the VLC Player proper.
Anyway, does anyone have an example of this?
update 1
After following xhochy suggestion of /?slist=
And building VLCKit # version 2.1-stable
The following code will play a stream:
#import <VLCKit/VLCKit.h>
self.player = [[VLCMediaPlayer alloc] init];
VLCMedia *media = [VLCMedia mediaWithURL:[NSURL URLWithString:#"<location>/?slist=<resource>"]];
self.player.media = media;
[self.player play];
update 2
You will also need to codesign the Framework after it's built, the command you are looking for is here:
codesign -v -f -s <your 40 char hash or common name> --deep VLCKit.framework/Versions/A

To play Beats Music in VLC(kit) you need to concatenate the rtmp URL via '/?slist=' so that you have <location>/?slist=<resource> as your final URL. You will need a very recent version of VLCkit (probably best is to build from git) as there some bugfixes needed to make it running smooth.

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 scan only a particular directory in Kodi via JSON-RPC?

I'd like to know how I can instruct Kodi to search for new (music) content only inside a particular directory via JSON-RPC.
I have my Kodi (more specifically OSMC) installed on a Raspberry Pi 2 and my music is hosted on another system via Samba (another Linux machine; Banana Pi). Now and then I get new music and first tag the whole album utilizing beets on the Banana Pi. Then, after the music was placed into its destination folder I perform a JSON-RPC call to my Kodi machine using this command:
curl --data-binary "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Scan\", \"id\": 1}" -H "content-type: application/json;" http://$KODIHOST/jsonrpc
Now I know that I can pass a parameter directory to the AudioLibrary.Scan command, but I don't quite know the correct syntax for that. When I only want one particular album folder to be scanned, what would the correct syntax look like? Should I pass it the physical path where the music lies on the music host (like smb://{HOST}/HDD1/Media/Music/Albums/{Album_Name}) or rather use the virtual directory names that I have in my Kodi library (like Albums, Compilations etc.)?
I already tried it a few times with the smb:// prefix approach in different variations but it either wouldn't work at all or it would just scan the whole music library which takes quite some time.
Any advice on how to achieve what I want and whether it's possible to the granularity I'd expect is highly appreciated!
I just want to bring this to a close for posterity.
My Problem
When I add new music to my network drive and organize it with beets, I also want it to show up in my Kodi media center. Now, issueing a AudioLibrary.Scan over Kodi's JSON-RPC API would rescan my whole music library which consists of tons of albums and could take up some while. What I needed was a way to tell Kodi to just scan that particular album or single - I know the path to that album after all since I just organized it.
The solution
Actually it was pretty easy since I was almost half-way there. All I had to do was adding an additional object named params to the JSON-RPC call and within that passing the directory string. In this example, my music resides on HDD1/Media/Music/Albums on host BPI1 on my Samba network. So the path to my music that's configured in .kodi/sources.xml on my media center looks like this:
smb://BPI1/HDD1/Media/Music/Albums
That's the path you'll want to take as the directory argument for your RPC call and append the album name to it so that Kodi only scans that particular directory and nothing else. An example request for passing it via cURL could look like this:
{
"json_rpc": "2.0",
"method': "audiolibrary.scan",
"id": 1,
"params": {
"directory": "smb://BPI1/HDD1/Media/Music/Albums/Lenny.Kravitz-It.is.Time.for.a.Love.Revolution"
}
}
This would make Kodi scan Lenny Kravitz' album and spare out all the rest.
EDIT:
If you listen to lots of singles then just append the filename to your directory string and Kodi will only add this one song to your library. Like this:
smb://BPI1/HDD1/Media/Music/Albums/Lenny.Kravitz-It.is.Time.for.a.Love.Revolution/01-Love.Revolution.mp3

How to download and join a movie in vlc

I know how to download a streaming movie with VLC but I have a problem. When it comes to a movie that comes in sequencial links like movie_part_1 , movie_part_2, etc, how can I download all of the parts and joint them together?
Thank you!
multiple mpg files can be combined into one output file using command line tool ffmpeg
ffmpeg -i "concat:input1.mpg|input2.mpg|input3.mpg" -c copy output.mpg
see details at https://trac.ffmpeg.org/wiki/Concatenate

Playlist file(m3u8) give another playlist file infinitely not giving any media file

I have a playlist file which give me another playlist file which also give me another playlist file, continously.
How can I play this playlist file? and Where can I found the source of video?
For example, I have a playlist file. That is
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=355670
http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=195968950
If I access to http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=195968950, it give me other playlist files.
#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:894
#EXTINF:11,
media_894.ts?wowzasessionid=195968950
#EXTINF:10,
media_895.ts?wowzasessionid=195968950
#EXTINF:11,
media_896.ts?wowzasessionid=195968950
If I access to the results, it also give me playlist files.
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=373764
http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=1093961187
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=382539
http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=1566364859
etc...
Although I can play the url http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=195968950 in safari in my iphone, I want to play this url in my own iphone app.
How can I play m3u8 file extension by myself?
EDIT - May be a duplicate of this SO question but if you want to persist the file, you'll need to go the hard way listed below.
Easy way = Embed UIWebView in your app and initialize it with the url of the .m3u8 file. This will open up quicktime which understands m3u8 and it will play it as it downloads.
Hard way = manually create the request/responses for each part of the m3u8 session and then download each .ts file in turn from the playlist file. As you get each "chunk" of the video, write it to a file or memory, then append the next "chunk" after it. I've done this for a h.264 encoded .m4v file served as a m3u8 and it worked (my code is too ugly to paste) but the pseudocode is:
Fetch the m3u8, saving any cookies sent and any headers that may be important*
Parse the .m3u8 (the first file, with the #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=373764) and pull our the urls.
Fetch the playlist from one of the URLs in the .m3u8 file (being sure to keep any headers/cookies in the request that may be necessary)
Parse the playlist file, saving as much metadata as you need from the top part of the file, construct an absolute URL for each .ts path, then stuff it into an array.
Iterate over the array (again, being mindful of cookies/headers) and fetch the content of each .ts URL into a file.
Play the downloaded file with whichever Media Framework you choose (search SO for how to do this)
If you just need to play the files, go the easy route. If you need to persist them, you need to do the m3u8 dance.
*HTTP Scoop is invaluable for seeing how the m3u8 "protocol" works and for making sure you're request/response headers are accurate - http://tuffcode.com/
*I used vanilla NSURLConnection synchronous calls as my code was just a proof of concept, other network frameworks like AFNetworking will make this a lot easier.

List Out all video from url

I am trying to list out all Video from a url. For this i m sending an request to "You Tube"
url as "http://www.youtube.com/" and want to list out all available video . But i didn't get anything from that request ? any idea or any documentation hint ?
There are utilities for downloading youtube videos (for example Linux has youtube-dl), but it's not uncommon for sites with large numbers of downloadable files to prevent attempts to simply download everything - and even though you said you wanted to list rather than download all the videos, that's unfortunately what it would suggest to a website administrator.
Besides, files on youtube are not accessed by simple urls like http://www.youtube.com/filename
Something more is required. I don't think you can treat the (what is it?) 11 character alphabet soup as a filename, it's a parameter passed to the software which streams back the video.
EDIT: youtube-dl is a command-line program in Linux and probably BSD. You need to know the URL of the Youtube video so you can type (for example)
youtube-dl http://www.youtube.com/watch?v=Z1JZ9O15280
If you had a list of these URLs you could put them in a file and make a bulk download script - but that takes us back to your original question.
In Firefox I would right-click on a link to a Youtube video and choose 'copy link location'. Then paste the URLs one at a time into a text file. But this question is drifting away from mere programming...