Thursday, 17 November 2011

rtmpdump for Wowza streams

Many sites stream video over RTMP. They hope this BS will save them from people downloading their videos. However RTMP only make their and our lives harder.
So they embed a flash player on the page and provide it with Url to RTMP streaming server like Wowza. All this then lags and is hard to debug. And is supposed to be hard for people to download videos, but fear not.

Today I wanted to download a video from one of Ukrainian news agencies, first look at page source provided me with the RTMP stream URL, well they could hid it but there are other 100% working ways to get it, and there is nothing that can be done on server side to prevent it.

So the URL I got is
"rtmp://91.230.92.3:80/vod/ictv/2011/11/09/mp4:20111109122602.mp4"

To play such stream you can take 'rtmpdump' program which is also available in Ubuntu repositories. Problems start when you try download it and basic parser fails to parse stream name form such URL. Well, normal URL is [protocol]://[host]:[port]/[path], guys who designed all these streaming servers decided to have 2 parts in path [app]/[stream] also there is no way to say what is app and what is stream just looking on the RTMP URL. Most players just have something hardcoded inside or just try all combinations before they find the one that works. In my case, 'rtmpdump' parser thought that "vod/ictv" is the app part and with

rtmpdump -r "rtmp://91.230.92.3:80/vod/ictv/2011/11/09/mp4:20111109122602.mp4" -o out2.flv

I only got - NetStream.Play.StreamNotFound
Usual schema is
[protocol]://[host]:[port]/<one word for app>/<Stream id is everything else>

So to download my video I had to go like

rtmpdump -r "rtmp://91.230.92.3:80/vod/ictv/2011/11/09/mp4:20111109122602.mp4" \
--app "vod" -y "mp4:ictv/2011/11/09/20111109122602.mp4" -o out2.flv

Now it went just ok. Thing may be different in your case, just play around URL.

Wednesday, 9 November 2011

s3cmd : Delete all files in a bucket


Unfortunately, s3cmd cannot delete files with a wildcard.  You cannot just

s3cmd del s3://my-bucket/*

Well, you can, s3cmd will also report "Object * deleted" but all your files stay in the bucket!
I know why guys in Amazon decided to do so but that is a long story, let's go back to practice.
I suggest a unix-way here (well, I would suggest it anyway):

s3cmd ls s3://my-bucket/  | awk '{print $4}' | xargs s3cmd del

That is all, You will get list of files in an output.

Another way, is to "s3cmd sync" your bucket against an empty directory