librtmp and pythonHi everybody,
since a few days I'm facing a very stressful issue with librtmp and python 2.7 (my os is Windows 7). I'm trying to connect to a stream on justin tv but I've probably an encoding issue with jtv token string. Here is my code: Code:
print 'instantiate rtmp connection' tcUrl=rtmp://199.9.255.143/app/jtv_toTs9DzRvV8WPazW swfUrl=http://www-cdn.jtvnw.net/widgets/live_site_player.ra3170e7f148ff63b2f1b4dfef2840842 de54e7f8 .swf token=a6faa3f74e0927e80039bb612522d637530d6395:{\" swfDomains\": [\"justin.tv\", \"jtvx.com\", \"xarth.com\", \"twitchtv.com\", \"twitch.tv\", \"n ewjtv.com\", \"jtvnw.net\", \"wdtinc.com\", \"imapweather.com\", \"facebook.com\", \"starcrafting.com\"], \"streamName\": \"jtv_toTs9DzRvV8WPazW\", \" expiration\": 1332084704.643841, \"geo_ip\": \"82.243.172.91\", \"server\": \"lhr01-video3-2\"} does anybody knows how to fix this? Thanks Regards, Gontran |
Re: librtmp and pythonQuote:
Code:
Special characters in values may need to be escaped to prevent Code:
jtv=a6faa3f74e0927e80039bb612522d637530d6395:{\22\20swfDomains\22:\20[\22justin.tv\22,\20\22jtvx.com\22,\20\22xarth.com\22,\20\22twitchtv.com\22,\20\22twitch.tv\22,\20\22newjtv.com\22,\20\22jtvnw.net\22,\20\22wdtinc.com\22,\20\22imapweather.com\22,\20\22facebook.com\22,\20\22starcrafting.com\22],\20\22streamName\22:\20\22jtv_toTs9DzRvV8WPazW\22,\20\22expiration\22:\201332084704.643841,\20\22geo_ip\22:\20\2282.243.172.91\22,\20\22server\22:\20\22lhr01-video3-2\22} |
Re: librtmp and pythonThank you KSV, you made my day.
Though I read the doc, I dont understand how I missed that! |
Re: librtmp and pythonNow that I managed to retrieve a stream, I would like to get log from librtmp.
According to ctypes documentation and given functions signatures from log.h/log.c, I wrote this in my code: Code:
CMPFUNC = CFUNCTYPE(c_int, c_int, c_char_p, c_void_p) Code:
Parsed host : ☺Parsed app : ☺connect to stream Code:
%s, ... connected, handshaking That 's why I'm asking for help. Thanks in advance. Regards, Gontran |
Re: librtmp and pythonI am not a python coder so i can't provide you a definite answer. but what you are referring as message in your code is actually format string. va_list contains the actual data to be filled in format string to create complete string. you can't pass va_list to another function. try to use PyArg_VaParse.
|
Re: librtmp and pythonThank you KSV for your concern but as far as I know, PyArg_VaParse has to be used in c programms.
I tried to reproduce the same code as shown in this thread (http://stream-recorder.com/forum/usi...n-t11025.html? but this doesn't work. Anyway, I'll dig deeper tonight. Regards, Gontran |
Re: librtmp and pythonJust don't pay attention to my last messages: I was tired and doing all wrong!
The only thing needed was to set the log level (by default nothing) in order to see logs in the standard output: Code:
#That's all!!!! |
Re: librtmp and pythonAs I said earlier, here a little class that wraps librtmp in order to get streams:
Code:
# -*- coding: utf-8 -*- Code:
# construct the url before as mentionned in librtmp manpage Hope this will be usefull! Regards, Gontran |
Re: librtmp and pythonQuote:
I started work on something similar about a month ago and I'm surpirsed your script works. I had to define custom ctype structure & union classes for my script, other wise it would complain about segmentation faults. I am running linux though, so maybe windows doesn't care as much. |
Re: librtmp and pythongontran,i see your ip on 1 post or not?
|
Re: librtmp and pythonQuote:
Could you be more precise on the errors you got running my script? We can improve it alltogether. |
Re: librtmp and pythonQuote:
|
Re: librtmp and pythonQuote:
I too am also getting the DNS error. I'm running from windows too. Cant figure out what could be causing it. Any ideas? I did a bit of googleing and someone has the same problem when implementing librtmp with VB, and he forgot to initialise winsock. But I'm not really sure what the issue is here. Thanks |
Re: librtmp and pythonFixed it by inserting
Code:
import socket |
Re: librtmp and pythonThis project was definitively abandoned?
I refer to the issue of segmentation fault ... |
All times are GMT -6. The time now is 09:49 PM. |