
Recherche avancée
Autres articles (42)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (10384)
-
Blog series part 2 : How to increase engagement of your website visitors, and turn them into customers
8 septembre 2020, par Joselyn Khor — Analytics Tips, Marketing -
Decode IP camera RTSP stream to pictures with ffmpeg library
10 mars 2024, par larsI use c++ with curl library on linux to connect to my IP camera and retrieve data from RTPS video stream. I have succeeded to decode RTSP and RTP data but I haven't managed to put together the data into a frame that ffmpeg can read. I have read everything there is to read with no success. Is there anyone who can explain how to do this.


Thanks


Here is what I have come up with.


curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE);



Parsing callback sdp description :


packetization_mode = 1
e.i Non-Interleaved mode

sprop-parameter-sets :


Nal unit (SPS) = 274d0028e7403c0113f2e029414141...8ae0000f4145fffc0a 
Nal unit (PPS) = 28ee3c80 (Both are decoded values)



Parsing SPS givs pic size 1920x1088 (the 8 ?)


curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY);
curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, URL_RTSPREQ_RECEIVE);



Callback function :
Search for SPS, PPS and fragmentations


size_t interleavedCallback(uint8_t *data, size_t size, size_t nmemb, USER_DATA *userp) {
 size_t data_size = size * nmemb;
 uint8_t *rtp_hdr = data + RTSP_HDR_SIZE;
 uint8_t *payload = data + RTSP_HDR_SIZE + RTP_HDR_SIZE;
 size_t payload_size = data_size - (RTSP_HDR_SIZE + RTP_HDR_SIZE);
 int seqNum = 0;

 uint8_t u = payload[0] << 3;
 int type = u >> 3; // nal_unit_type
 int nri = payload[0] >> 5;
 seqNum = (rtp_hdr[2] << 8) + rtp_hdr[3];

 int ret = memcmp(payload, userp->sdp_data.SPS, userp->sdp_data.sizeSPS);
 if (0 == ret && !userp->newFrame) {
 userp->newFrame = true;
 payload[0] = type + 0x60; // nal_unit_type

 size_t memsize = payload_size + sizeof(uint32_t);
 userp->frame.pFrame = (uint8_t*)calloc(memsize, sizeof(uint8_t));
 userp->frame.pFrame[3] = 1;
 memcpy(userp->frame.pFrame + sizeof(uint32_t), payload, payload_size);
 userp->frame.size = memsize;
 }
 else if (userp->newFrame && 28 == type && payload[1] == 0x45) {
 stop;
 userp->newFrame = false;
 size_t memsize = userp->frame.size + payload_size;
 userp->frame.pFrame = (uint8_t*)realloc(userp->frame.pFrame, memsize);
 payload[0] += 0x40;
 memcpy(userp->frame.pFrame + userp->frame.size, payload, payload_size);
 userp->frame.size = memsize;
 
 streamParser(userp->frame.pFrame, userp->frame.size);
 }
 else if (userp->newFrame) {
 if (8 == type) {
 payload[0] = type + 0x60; // nal_unit_type
 size_t memsize = userp->frame.size + payload_size;
 userp->frame.pFrame[0] = 0;
 userp->frame.pFrame[1] = 0;
 userp->frame.pFrame[2] = 0;
 userp->frame.pFrame[3] = 1;
 userp->frame.pFrame = (uint8_t*)realloc(userp->frame.pFrame, memsize);
 memcpy(userp->frame.pFrame + userp->frame.size, 
 payload, payload_size);
 userp->frame.size = memsize;
 }
 else if (28 == type) {
 size_t memsize = userp->frame.size + payload_size;
 userp->frame.pFrame = (uint8_t*)realloc(userp->frame.pFrame, memsize);
 payload[0] += 0x40;
 memcpy(userp->frame.pFrame + userp->frame.size, payload, payload_size);
 userp->frame.size = memsize;
 }
 }

 return data_size;
}


void streamParser(uint8_t *frame, size_t size) {
 AV avinfo;

 avinfo.packet = av_packet_alloc();
 avinfo.codec = avcodec_find_decoder(AV_CODEC_ID_H264);
 avinfo.context = avcodec_alloc_context3(avinfo.codec);
 if (avcodec_open2(avinfo.context, avinfo.codec, NULL) >= 0) {
 avinfo.frame = av_frame_alloc();
 avinfo.packet->data = frame;
 avinfo.packet->size = size;
 
 int ret = avcodec_send_packet(avinfo.context,avinfo.packet);
 if (ret < 0) {
 return -1;
 }
 ......

 av_frame_free(&avinfo.frame);
 }
 avcodec_close(avinfo.context);
 av_free(avinfo.context);
}



Error from avcodec_send_packet : no frame !


-
How to play mp4 video file with HTML5 video tag on iOS (iPhone and iPad) ?
22 avril 2015, par MokielasI want to display HTML5 video to my users using the video tag. For Firefox, Chrome and Opera WEBM works as expected. In Safari on Windows and Mac my MP4 version works, too. The only problem I’m experiencing is, that it won’t play on iPad and iPhone (Safari of course).
Create video
The MP4 (h.264 + acc-lc) is converted like this (with profile : baseline and level 3.0 for maximum compatibility with iOS) :
- Stream #0:0(eng) : Video : h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x352, 198 kb/s, 17 fps, 17 tbr, 17408 tbn, 34 tbc (default)
- Stream #0:1(eng) : Audio : aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 56 kb/s (default)
Edit : Whole ffprobe output (slight changes in bitrate etc. to the above mentioned) :
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.30.100
Duration: 00:01:00.05, start: 0.046440, bitrate: 289 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline)
(avc1 /0x31637661), yuv420p, 640x352, 198 kb/s, 25 fps, 25 tbr,
12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 85 kb/s (default)
Metadata:
handler_name : SoundHandlerI found various requirements for iOS devices like this and this, also someone mentioned to add the yuv420p pixel format when converting.
In fact the ffmpeg cmd looks like this :
ffmpeg -i __inputfile__ -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -b:v 200K -r 17 -bt 800K -c:a libfdk_aac -b:a 85k -ar 44100 -y __outputfile_lowversion__.mp4
Display video
With Modernizr I detect which format is "supported" and add it to the
src
or thevideo
tag. Last thing is adding the right MIME type. For mp4 I addtype="video/mp4"
. The full code for thevideo
tag is :<video class="p-video" preload="auto" autoplay="" type="video/mp4" src="http://full.url/to/video_low.mp4"></video>
I tried various ways : own implementation with own interface, controls and stuff from browser vendors and video.js just to check whether i’m too studip for this. All work in the environments listed above except for iPhone and iPad.
I read this article on Video on the web, especially this part and only serve the "right" file with the "right" type without a
poster
attribute set.My Apache has
AddType video/mp4 mp4 m4v f4v f4p
AddType video/ogg ogv
AddType video/webm webmAnd byte-ranges are enabled. This is needed to get partial content from the server.
Has anyone a clue what’s going on there ? Thanks in advance !
Edit : Safari and Chrome both throw
MEDIA_ERR_SRC_NOT_SUPPORTED
Error on iPad. There must be an issue with the encoding.