
Recherche avancée
Autres articles (60)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...)
Sur d’autres sites (8613)
-
tests/Makefile : Add FRAMECRC variants for filtering
17 mai 2022, par Andreas Rheinhardttests/Makefile : Add FRAMECRC variants for filtering
Lots of tests use the framecrc command together with some filters,
so adding a special function for it seems worthwhile. This commit
adds one new one and modifies an already existing one :
All users of FILTERDEMDEC already use framecrc and the more general
FILTERDEMDECENCMUX can be used in scenarios where more control over
the used encoders/muxers is needed, so use this in cases where
an actual input file is involved.
Furthermore, add FILTERFRAMECRC for the cases where no demuxing/decoding
occurs, because the input is generated via lavfi.Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-
Problem decoding h264 over RTP TCP stream
4 mai 2022, par Kamil.SI'm trying to receive RTP stream encoding h264 over TCP from my intercom Hikvision DS-KH8350-WTE1. By reverse engineering I was able to replicate how Hikvision original software Hik-Connect on iPhone and iVMS-4200 on MacOS connects and negotaties streaming. Now I'm getting the very same stream as original apps - verified through Wireshark. Now I need to "make sense" of the stream. I know it's RTP because I inspected how iVMS-4200 uses it using
/usr/bin/sample
on MacOS. Which yields :

! : 2 CStreamConvert::InputData(void*, int) (in libOpenNetStream.dylib) + 52 [0x11ff7c7a6]
+ ! : 2 SYSTRANS_InputData (in libSystemTransform.dylib) + 153 [0x114f917f2]
+ ! : 1 CRTPDemux::ProcessH264(unsigned char*, unsigned int, unsigned int, unsigned int) (in libSystemTransform.dylib) + 302 [0x114fa2c04]
+ ! : | 1 CRTPDemux::AddAVCStartCode() (in libSystemTransform.dylib) + 47 [0x114fa40f1]
+ ! : 1 CRTPDemux::ProcessH264(unsigned char*, unsigned int, unsigned int, unsigned int) (in libSystemTransform.dylib) + 476 [0x114fa2cb2]
+ ! : 1 CRTPDemux::ProcessVideoFrame(unsigned char*, unsigned int, unsigned int) (in libSystemTransform.dylib) + 1339 [0x114fa29b3]
+ ! : 1 CMPEG2PSPack::InputData(unsigned char*, unsigned int, FRAME_INFO*) (in libSystemTransform.dylib) + 228 [0x114f961d6]
+ ! : 1 CMPEG2PSPack::PackH264Frame(unsigned char*, unsigned int, FRAME_INFO*) (in libSystemTransform.dylib) + 238 [0x114f972fe]
+ ! : 1 CMPEG2PSPack::FindAVCStartCode(unsigned char*, unsigned int) (in libSystemTransform.dylib) + 23 [0x114f97561]`



I can catch that with lldb and see the arriving packet data making sense as the format I'm describing.


The packet signatures look following :




0x24 0x02 0x05 0x85 0x80 0x60 0x01 0x57 0x00 0x00 0x00 0x02 0x00 0x00 0x27 0xde
0x0d 0x80 0x60 0x37 0x94 0x71 0xe3 0x97 0x10 0x77 0x20 0x2c 0x51 | 0x7c
0x85 0xb8 0x00 00 00 00 01 65 0xb8 0x0 0x0 0xa 0x35 ...


0x24 0x02 0x05 0x85 0x80 0x60 0x01 0x58 0x00 0x00 0x00 0x02 0x00 0x00 0x27 0xde
0xd 0x80 0x60 0x37 0x95 0x71 0xe3 0x97 0x10 0x77 0x20 0x2c 0x51 | 0x7c 0x05 0x15 0xac ...


0x24 0x02 0x5 0x85 0x80 0x60 0x01 0x59 0x00 0x0 0x00 0x02 0x00 00x0 0x27 0xde
0xd 0x80 0x60 0x37 0x96 0x71 0xe3 0x97 0x10 0x77 0x20 0x2c 0x51 | 0x7c 0x05 0x5d 0x00 ...




By the means of reverse engineering the original software I was able to figure out that
0x7c85
indicates a key frame.0x7c85
bytes in the genuine software processing do get replaced by h26400 00 00 01 65
Key frame NALU . That's h264 appendix-B format.
The0x7c05
packets always follow and are the remaining payload of the key frame. No NALU are added during their handling (the0x7c05
is stripped away and rest of the bytes is copied). None of the bytes preceding 0x7cXX make it to a mp4 recording (that makes sense as it's the RTP protocol , albeit I'm not sure if it's entirely RTP standard or there's something custom from Hikvision).

If you pay close attention in the Header there are 2 separate bytes indicating order which always match, so I'm sure no packet loss is occurring.


I also observed nonkey frames arriving as
0x7c81
and converted to00 00 00 01 61
NALU but I want to focus solely on the single key frame for now. Mostly because if I record a movie with the original software it will always begin with00 00 00 01 65
Key frame (that obviously makes sense).

To get a working mp4 I decided to copy paste a mp4 header of a genuine iVMS-4200 recording (in this sense that's every byte preceding 1st frame NALU
00 00 00 01 65
in the mp4 file). I know that the resolution will match the actual camera footage. With the strategy of waiting for a keyframe , replacing0x7c85
with00 00 00 01 65
NALU and appending the remaining bytes, or only appending bytes in the0x7c05
case I do seem to get something that eventually could work.
When I attempt toffplay
the custom craftedmp4
result I do get something (with a little stretch of imagination that's actually the camera fisheye image forming), but clearly there is a problem.



It seems around 3-4th
0x7c05
packet (as the failing packet differs on every run), when I copy bytes eventually the h264 stream is incorrect. Just by eye-inspecting the bytes I don't see anything unusual.

This is the failing packet around offset 750 decimal, (I know it's around this place because I keep stripping bytes away to see if there's still same amount frame arriving before it breaks).


More over I did dump those bytes from original software using lldb taking out my own python implementation out of equation. And I run into very same problem with the original packets.


The mp4 header I use should work (since it does for original recordings even if I manipulate number of frames and leave just the first keyframe).
Correct me if I'm wrong but the phase of converting this to MPEG2-PS (which iVMS-4200 does and I don't) should be entirely optional and should not be related to my problem.


Update :
I went the path of setting up recording and only then dumping the original iVMS-4200 packets. I edited the recorded movie to only contain keyframe of interest and it works. I found differences but I cannot explain where they are there yet :


Somehow
00 00 01 E0 13 FA 88 00 02 FF FF
is inserted in the genuine recording (that's 4th packet), but I have no idea how this byte string was generated and what is its purpose.
When I fixed the first difference the next one is :

The pattern is striking. But what
00 00 01 E0 13 FA 88 00 02 FF FF
actually is ? And why is it inserted after18 03 25 10
&2F F4 80 FC

The00 00 01 E0
signature would suggest those are Packetized Elementary Stream (PES) headers

-
FFmpeg/libav Storing AVPacket data in a file and decoding them again in a different stream - How to prepare and send custom packets in the decoder ?
21 avril 2022, par HitokageI want to be able to open a stream with a video file and send in the decoder my own packets with data that I previously stored from a different stream with the same codec. So like forging my own packets in the decoder.


My approach is that I encode frames into packets using H.265 and store the data in a file like this :


AVPacket *packet;
std::vector data;
...encoding...
data->insert(data->end(), &packet->data[0], &packet->data[packet->size]);
...storing the buffer in a file...



I also have one mkv video with H.265 stream of the same parameters. Now I want to get the stored packet data in the file, create a new packet, and send it into the decoding process of the mkv file. To make it easier I just copy the parameters of the first packet in the mkv stream into a new packet where I insert my data and send it to the decoder. Is this a right approach ?


...open decoder with mkv file...
auto packet = av_packet_alloc();
av_read_frame(formatContext, packet);
//here is the packet I will use later with my data
av_packet_copy_props(decodingPacket, packet);
decodingPacket->flags = 0;
//sending the packet from the mkv
avcodec_send_packet(codecContext, packet);
//the data contains the previously stored data
av_packet_from_data(decodingPacket, data.data(), data.size());
avcodec_send_packet(codecContext, decodingPacket);
...retrieving the frame...



However, I am getting this error when I try to send the forget packet :


Assertion buf_size >= 0 failed at libavcodec/bytestream.h:141



I have tried to manually change the
decodingPacket->buf->size
but that is probably not the problem. I believe that I need to set up some other parameters in the forged packet but what exactly ? Maybe I can also somehow store not only the packet data but the whole structure ? Please let me know, if there is a better way to store and reload a packet and force it into an unrelated decoder with the same parameters.
Thanks !

EDIT : Seems like the buf_size problem was related to my data which were wrongly retrieved. I can confirm that this works now but I am getting a new error :


[hevc @ 0x559b931606c0] Invalid NAL unit size (0 > 414).
[hevc @ 0x559b931606c0] Error splitting the input into NAL units.