
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (57)
-
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
MediaSPIP en mode privé (Intranet)
17 septembre 2013, parÀ partir de la version 0.3, un canal de MediaSPIP peut devenir privé, bloqué à toute personne non identifiée grâce au plugin "Intranet/extranet".
Le plugin Intranet/extranet, lorsqu’il est activé, permet de bloquer l’accès au canal à tout visiteur non identifié, l’empêchant d’accéder au contenu en le redirigeant systématiquement vers le formulaire d’identification.
Ce système peut être particulièrement utile pour certaines utilisations comme : Atelier de travail avec des enfants dont le contenu ne doit pas (...)
Sur d’autres sites (8590)
-
Why does my nginx endpoint streaming audio via ffmpeg fail with "An unexpected TLS packet was received"
6 décembre 2020, par rajaman0I'm using nginx to proxy requests to a flask/gunicorn API. For most of my endpoints, it works perfectly - however, I have one endpoint which serves an audio response (through ffmpeg) which doesn't seem to work no matter what I try. Running everything through docker.


Here's my nginx config :


server {
 listen $PORT;
 root /usr/share/nginx/html;
 index index.html index.html;

 access_log /var/log/nginx/reverse-access.log;
 error_log /var/log/nginx/reverse-error.log;

 location / {
 try_files $uri /index.html =404;
 }

 location /api/stream_audio_file {
 proxy_pass http://backend;
 proxy_http_version 1.1;
 proxy_set_header Connection "keep-alive";
 proxy_set_header Host $host;

 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Host $server_name;
 }



Here's the core of the python code for http://backend/api/stream_audio_file (run through flask, gunicorn)


ffmpeg_options = ['-i', 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3']
ffmpeg_options += ["-f", "mp3"]
ffmpeg_options += ["-to", '00:00:02.000']
ffmpeg_options += ["-vn"]
ffmpeg_options += ["-ab", "256k"]
ffmpeg_options += ["-strict", "-2"]
ffmpeg_options += ["-loglevel", "trace"]
p = Popen(["ffmpeg"] + ffmpeg_options + ["-"],
 stdout=PIPE)
max_bytes = 256000
output = p.stdout.read(max_bytes)
return Response(output, headers={
 "Content-Type": "audio/mp3",
 "icy-name": yt_info['title'].encode('latin-1', 'ignore'),
 "icy-bitrate": "256",
 "ice-audio-info": "bitrate=256",
 "Cache-Control": "no-cache"
})



When I test out this endpoint, I've pasted the full ffmpeg logs here : https://pastebin.com/wMMpmL6M
Of import, it seems to fetch the mp3 url appropriately but fails with error :


[tls @ 0x555bf3011a80] An unexpected TLS packet was received.
https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3: I/O error
[out_0_0 @ 0x555bf302ab00] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.



I've tried quite a few things :


- 

- This endpoint works without nginx. I tried querying just the endpoint running w/ just gunicorn, and responses are streamed back correctly. Thus the error HAS to be nginx related ?
- The error being TLS related is confusing - I've tried setting up nginx w/ ssl on and adding certs, but that doesn't help / change the error in any way.
- I've tried playing around with headers in both nginx and on the python side, following some of the examples here : https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/. Doesn't work.
Response(stream_with_context(..)
in flask doesn't work either.- Don't know much about nginx, but tried some other suggestions e.g. buffering / no buffering through nginx, etc, nothing seems to work :(.
- When I ssh into my docker container, and run the same ffmpeg command
ffmpeg -i https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 -f mp3 -to 00:00:02.000 -vn -ab 256k -strict -2 -loglevel trace
outside of the request context, it works ! - Tried compiling ffmpeg with both openssl and gnutls, neither works. However : the openssl version fails w/

tls @ error:1408F1BB:SSL routines:ssl3_get_record:bad record type
instead.
















Please let me know what other debugging info would be helpful / if anyone has any hypothesis I can test out.


-
How to reencode flash stream to MP4 or/and WebM inside server implementation ?
18 avril 2013, par user2294505Hi guys, lets start with this that I'm totally new in video streaming.
Currently I have to support one server implemented in C that work as mediator between stream producers and stream consumers. In my case I have one remote machine that generate flash stream and one or more clients that can watch it. The server work as proxy for all of them. We are using our server side implementation for rtmp protocol and for asynchronous work over HTTP we are using libevent library. All this construction work fine in common case.
Now we need to transfer this stream to HTML5 clients and we need to support new formats. Our decision was that MP4 and WebM are enough for us. Base of the HTTP request our internal implementation recognized what type of stream client need. For example when the client need MP4 URI is something like this :
http://192.168.0.5/video.mp4?blah-blah-blah
where "blah-blah-blah" are few parameters to impersonate client. We have already implemented mechanism that convert input frames to raw pictures and this implementation work fine when we stream JPEGs as again we are using libavformat library to encode raw picture to JPEG. In case with JPEGs the contents of the stream data must contain HTTP meta data with description of every picture. The client stream request is same as this for MP4 stream but instead video.mp4 we are uising jpegstream.htm
Now I need to convert this input stream to MP4 and/or WebM and here start my problems. For generating Mp4 and WebM videos I'm using ffmpeg libraries and base of one of ffmpeg examples (muxing) I'm trying to convert already generated pictures to currently selected new format. More or less this conversion is OK but after than I don't know why I can't send video to consumer. I'm using next code to prepare avio context :
int iSize = 4 * 1024;
unsigned char *ptrBuf = ( unsigned char * )av_malloc( iSize );
ptrOFC->pb = avio_alloc_context( ptrBuf, iSize, 1, ptrTCDObj, NULL, write_pkg, NULL );
if ( !ptrTCDObj->ptrOFC->pb ) {
goto ERROR;
}
avformat_write_header( ptrOFC, NULL );When the server receive frame from flash we are converting it to corresponding output format with code like this :
iResult = avcodec_encode_video2( ptrTCDataObj->m_ptrOCC, &packet, pictureFrame, &iGotPacket ) ;
and write it to stream when succeed and packet exist with :
av_interleaved_write_frame( ptrOFC, &packet );
Here our code expect to receive in one moment call to write_pkg function. But nothing happen here :-(. Situation is 100% same if I'm using direct write with av_write_frame. The write_pkg function has very simple body :
int write_pkg( void *ptrOpaque, uint8_t *ptrBuffer, int iBufferSize )
{
STransCoderData_t *ptrTCDObj = ( STransCoderData_t * ) ptrOpaque;
struct evbuffer *ptrFrameOut;
ptrFrameOut = evbuffer_new();
evbuffer_add( ptrFrameOut, ptrBuffer,( size_t ) iBufferSize );
http_client_write_video( ptrFrameOut, ptrTCDObj->m_ptrHTTPClient, NULL );
evbuffer_free( ptrFrameOut );
return iBufferSize;
}Structure STransCoderData_t and function http_client_write_video is not interesting in this moment because we don't reach them for now :-(
For test consumer I'm using VLC player as open network stream :
http://192.168.0.5/video.mp4?blah-blah-blah
VLC don't show anything even errors.
Any ideas, comments and help are welcome.
-
Can ffmpeg concatenate mp3 files using the process at audio-joiner.com ?
7 juin 2020, par Ed999I have a dozen or more mp3 audio files, which I need to concatenate into a single mp3 file. The files all have the same bitrate (320 kbps) and sample rate (44.1 kHz), but all of them have differing durations.



I have studied the three methods of concatenation recommended on stackoverflow (How to concatenate two MP4 files using FFmpeg). One method actually works, but when I play back the output file I find that there are noticeable audio artifacts (audible glitches) at each join point.



I've been told that this problem is caused by the input files not having identical duration. This seems likely, because I've had some successes in concatenating audio files with identical bit rate, sample rate, and duration.



I have seen, online, some much more complex scripts which are, at present, miles beyond my understanding. One solution I was directed to required a fairly deep knowledge of Python !



However, my research also included a site at audio-joiner.com - and this had the only completely successful method I've yet found, for files of non-identical duration. That site processed some of my input files, joined the multiple files into one, and the concatenated output file it produced did not have any audible glitches at the joins.



I looked into the process the site was using, hoping to get a clue as to where I've been going wrong, but the script on the site (which looks like ajax-based javascript) is too complex for me to follow.



Because the process seemed to take quite a long time, I wouldn't be too surprised to learn that the mp3 input files are being converted to some other audio format, joined, then converted back to mp3 for the output. But if so, that wouldn't put me off using the process.



Is anyone familiar with the approach being used, and can say whether it might be reproducible using ffmpeg ?



.



ADDED -



There are 7 scripts, in all, listed in the source of the relevant page :



https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js
https://static.123apps.com/js/socket.io.js
https://static.123apps.com/js/shared_0.js
https://static.123apps.com/js/shared_1.js
https://static.123apps.com/js/ajoiner.js
https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js




.



ADDED -



The successful (javascript) function seems to be this, but it isn't obvious to me why it is succeeding (too complex for me !). Can anyone suggest what approach it is taking ? For example, is it transcoding the mp3 files to an intermediate format, and concatenating the intermediate files ?



function start_join(e){
 l("start_join():"),l(e);
 var t;
 return(t=$.parseJSON(e)) && $("#ajoiner").ajoiner("set_params",t),!0
}

function cancel_join(e){
 return l("cancel_join():"),l(e),!0
}

!function(o){
 var t={
 init:function(e){
 var t=o(this),n=o.extend({lang:{cancel:"Cancel",download:"Download"}},e);
 o(this).data("ajoiner",{o:n,tmp_i:1,pid:-1,params:{}});
 t.data("ajoiner");
 t.ajoiner("_connect"),o("body").bind("socket_connected",function(){t.ajoiner("_connect")})
 },set_params:function(e){
 var t=o(this).data("ajoiner");
 isset(e)?(e.uid=Cookies.get("uid"),t.params=e,t.params.lang_id=lang_id,t.params.host=location.hostname,t.params.hostprotocol=location.protocol,l("socket emit join:"),l(t.params),socket.emit("join",t.params)):error("set_params: params not set")
 },_connect:function(){

 var t=o(this).data("ajoiner");

 l("_connect"),socket.on("join",function(e){
 "progress"==e.message_type?(t.tmp_i,t.tmp_i++,void 0!==getObj("theSWF")&&(getObj("theSWF").set_join_progress(parseInt(e.progress_value)),l("SWF.set_join_progress("+parseInt(e.progress_value)+")")),isset(e.pid)&&(t.pid=e.pid)):"final_result"==e.message_type?(void(e.tmp_i=0)!==getObj("theSWF")&&(getObj("theSWF").join_finished(o.stringifyJSON(e)),l("SWF.join_finished('"+o.stringifyJSON(e)+"')")),last_conv_result=e):"error"==e.message_type&&l(e.error_desc)
 }
 )},_cancel_convert:function(){
 var e=o(this).data("ajoiner");
 0code>