
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (17)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
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 (...) -
Submit enhancements and plugins
13 avril 2011If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone.
Sur d’autres sites (3643)
-
A newbie Struggling with FFmpeg Video Encoding
19 avril 2014, par iJoseFrom last 1 week i have been struggling with FFmpeg video encoding.
I am capturing the video from the device camera using UIImagePickerController.
and the encoding it using the following function.After Encoding i am not able to save the video to my device camera roll.
i used UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(filepath) it returns Zero GOD KNOWS WHY
+(void)videoEncoder:(NSString *)filename
{
avcodec_register_all();
int codec_id = AV_CODEC_ID_MPEG4;
AVCodec *codec;
AVCodecContext *c= NULL;
int i, ret, x, y, got_output;
FILE *f;
AVFrame *frame;
AVPacket pkt;
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
printf("Encode video file %s\n", [filename UTF8String]);
/* find the mpeg1 video encoder */
codec = avcodec_find_encoder(codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
exit(1);
}
c = avcodec_alloc_context3(codec);
if (!c) {
fprintf(stderr, "Could not allocate video codec context\n");
exit(1);
}
/* put sample parameters */
c->bit_rate = 400000;
/* resolution must be a multiple of two */
c->width = 352;
c->height = 288;
/* frames per second */
c->time_base= (AVRational){1,25};
c->gop_size = 10; /* emit one intra frame every ten frames */
c->max_b_frames=1;
c->pix_fmt = AV_PIX_FMT_YUV420P;
if(codec_id == AV_CODEC_ID_MPEG4)
av_opt_set(c->priv_data, "preset", "slow", 0);
/* open it */
if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "Could not open codec\n");
exit(1);
}
f = fopen([filename UTF8String], "wb");
if (!f)
{
fprintf(stderr, "Could not open %s\n", [filename UTF8String]);
exit(1);
}
frame = av_frame_alloc();
if (!frame) {
fprintf(stderr, "Could not allocate video frame\n");
exit(1);
}
frame->format = c->pix_fmt;
frame->width = c->width;
frame->height = c->height;
/* the image can be allocated by any means and av_image_alloc() is
* just the most convenient way if av_malloc() is to be used */
ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height,
c->pix_fmt, 32);
if (ret < 0) {
fprintf(stderr, "Could not allocate raw picture buffer\n");
exit(1);
}
/* encode 1 second of video */
for(i=0;i<25;i++) {
av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
fflush(stdout);
/* prepare a dummy image */
/* Y */
for(y=0;yheight;y++) {
for(x=0;xwidth;x++) {
frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
}
}
/* Cb and Cr */
for(y=0;yheight/2;y++) {
for(x=0;xwidth/2;x++) {
frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
}
}
frame->pts = i;
/* encode the image */
ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
printf("Write frame %3d (size=%5d)\n", i, pkt.size);
fwrite(pkt.data, 1, pkt.size, f);
av_free_packet(&pkt);
}
}
/* get the delayed frames */
for (got_output = 1; got_output; i++) {
fflush(stdout);
ret = avcodec_encode_video2(c, &pkt, NULL, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
printf("Write frame %3d (size=%5d)\n", i, pkt.size);
fwrite(pkt.data, 1, pkt.size, f);
av_free_packet(&pkt);
}
}
/* add sequence end code to have a real mpeg file */
fwrite(endcode, 1, sizeof(endcode), f);
fclose(f);
avcodec_close(c);
av_free(c);
av_freep(&frame->data[0]);
av_frame_free(&frame);
printf("\n");
} -
blank transparent pngs behave like black canvas
10 novembre 2015, par Anay BoseI am trying to create a scrolling image with imagemagick’s roll and crop functions. Its a frame-by—frame animation. The source image is a transparent png with some text written on it. The following code works and it creates the required frames, including some blank png images at first for a nice, smooth effect. These blank pngs are what creating problems when I am trying to convert my image frames into video with ffmpeg. FFMPEG is seemingly considering these blank pngs as black/dark images, so the resulting video contains a blackout for a few seconds in the beginning—which I do not want.
I am using png codec with bgra pixel format. My ffmpeg command (shown below) creates smooth, clear animation with images that have some text on it.
"ffmpeg -i trans/trans-%d.png -vcodec png -pix_fmt bgra overlay-0.mov";
The blank pngs behave like black canvas, but as I try to write some text on them or surround them with a border (i.e. colorize in some way) the problem disappears—which seems very strange. I have tested all my images ; they are all transparent. For the past few hours, I have been searching for a solution, no luck so far. Please note those blank pngs are required in the beginning for a smooth effect, and I cannot omit them. I have uploaded a sample video in Youtube. Please note the black fade out.
https://www.youtube.com/watch?v=Te3LuItxcDk&feature=youtu.be
PHP code :
$increment = 40;
$count = 0;
for ($x=40; $x <= 640 ; $x+=$increment)
{
$roll = new Imagick(DOCROOT . '/composite-0.png');
$roll->rollImage($x, 0);
$roll->writeImage(DOCROOT . '/roll/roll-' . $x . '.png');
$crop = new Imagick(DOCROOT . '/roll/roll-' . $x . '.png');
$crop->cropImage($x, 720, 0, 0);
$crop->writeImage(DOCROOT . '/roll/crop-' . $x . '.png');
$extent = new Imagick(DOCROOT . '/roll/crop-' . $x . '.png');
# $extent->setImageBackgroundColor(new ImagickPixel('none'));
$extent->setImageBackgroundColor(new ImagickPixel('transparent'));
$extent->extentImage(640, $extent->getImageHeight(), 0, 0);
$extent->setImageFormat('png');
$extent->writeImage(DOCROOT . '/trans/trans-' . $count . '.png');
$count++;
} -
Injecting Metadata into an .mp4 file
21 août 2019, par TrueCP5I’m working on a library that injects metadata into a .mp4 file to allow the video to be displayed correctly as a 360 video. The input file is a standard .mp4 file in the equirectangular format. I know what metadata needs to be injected I just do not know how to inject it.
I spent some time looking around for libraries that can do this but could only find ones for extracting metadata not injecting/embedding/writing it. The alternative I found was to use Spatial Media as a command line application to inject the metadata more easily. The problem is I know zero python whatsoever so I’m leaning towards a library/nuget package/ffmpeg script.
Does a good nuget package/library exist that can do this or should I go for the alternative option ?
Edit 1
I have tried just pasting in the metadata into the correct place in the file, just in case it might work, but it didn’t.
Edit 2
This is the metadata injected by Google’s Spatial Media Tool which is what I am trying to achieve :
<?xml version="1.0"?>truetrueSpherical Metadata Toolequirectangular`
Edit 3
I’ve also tried to do it with ffmpeg like so :
ffmpeg -i input.mp4 -movflags use_metadata_tags -metadata Spherical=true -metadata Stitched=true -metadata ProjectionType=equirectangular -metadata StitchingSoftware=StreetviewJourney -codec copy output.mp4
I think the issue with the ffmpeg method is that it does not contain the
rdf:SphericalVideo
part which allows the spherical video tags to be used.Edit 4
When I extract the metadata using ffmpeg it contains the spherical tag in the logs but not when I output it to a ffmetadata file. This was the command I used :
ffmpeg -i injected.mp4 -map_metadata -1 -f ffmetadata data.txt
This is the output of the log :
fps, 60 tbr, 15360 tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
Side data:
spherical: equirectangular (0.000000/0.000000/0.000000)Edit 5
I also tried to get the metadata using this command :
ffprobe -v error -select_streams v:0 -show_streams -of default=noprint_wrappers=1 injected.mp4
This was the logs it outputted :
TAG:handler_name=VideoHandler
side_data_type=Spherical Mapping
projection=equirectangular
yaw=0
pitch=0
roll=0I then tried to use this command but it didn’t work :
ffmpeg -i chapmanspeak.mp4 -movflags use_metadata_tags -metadata side_metadata_type="Spherical Mapping" -metadata projection=equirectangular -metadata yaw=0 -metadata pitch=0 -metadata roll=0 -codec copy output.mp4
Edit 6
I tried @VC.One’s method but I must be doing something wrong because the output file is unplayable. Here is my code :
public static void Metadata(string inputFile, string outputFile)
{
byte[] metadata = HexStringToByteArray("3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 2E 30 22 3F 3E 3C 72 64 66 3A 53 70 68 65 72 69 63 61 6C 56 69 64 65 6F 0A 78 6D 6C 6E 73 3A 72 64 66 3D 22 68 74 74 70 3A 2F 2F 77 77 77 2E 77 33 2E 6F 72 67 2F 31 39 39 39 2F 30 32 2F 32 32 2D 72 64 66 2D 73 79 6E 74 61 78 2D 6E 73 23 22 0A 78 6D 6C 6E 73 3A 47 53 70 68 65 72 69 63 61 6C 3D 22 68 74 74 70 3A 2F 2F 6E 73 2E 67 6F 6F 67 6C 65 2E 63 6F 6D 2F 76 69 64 65 6F 73 2F 31 2E 30 2F 73 70 68 65 72 69 63 61 6C 2F 22 3E 3C 47 53 70 68 65 72 69 63 61 6C 3A 53 70 68 65 72 69 63 61 6C 3E 74 72 75 65 3C 2F 47 53 70 68 65 72 69 63 61 6C 3A 53 70 68 65 72 69 63 61 6C 3E 3C 47 53 70 68 65 72 69 63 61 6C 3A 53 74 69 74 63 68 65 64 3E 74 72 75 65 3C 2F 47 53 70 68 65 72 69 63 61 6C 3A 53 74 69 74 63 68 65 64 3E 3C 47 53 70 68 65 72 69 63 61 6C 3A 53 74 69 74 63 68 69 6E 67 53 6F 66 74 77 61 72 65 3E 53 70 68 65 72 69 63 61 6C 20 4D 65 74 61 64 61 74 61 20 54 6F 6F 6C 3C 2F 47 53 70 68 65 72 69 63 61 6C 3A 53 74 69 74 63 68 69 6E 67 53 6F 66 74 77 61 72 65 3E 3C 47 53 70 68 65 72 69 63 61 6C 3A 50 72 6F 6A 65 63 74 69 6F 6E 54 79 70 65 3E 65 71 75 69 72 65 63 74 61 6E 67 75 6C 61 72 3C 2F 47 53 70 68 65 72 69 63 61 6C 3A 50 72 6F 6A 65 63 74 69 6F 6E 54 79 70 65 3E 3C 2F 72 64 66 3A 53 70 68 65 72 69 63 61 6C 56 69 64 65 6F 3E");
byte[] stco = HexStringToByteArray("73 74 63 6F");
byte[] moov = HexStringToByteArray("6D 6F 6F 76");
byte[] trak = HexStringToByteArray("74 72 61 6B");
byte[] file = File.ReadAllBytes(inputFile);
//find trak
int trakPosition = 0;
for (int a = 0; a < file.Length - trak.Length; a++)
{
for (int b = 0; b < trak.Length; b++)
{
if (file[a + b] != trak[b])
break;
if (b == trak.Length - 1)
trakPosition = a;
}
}
if (trakPosition == 0)
throw new FileLoadException();
//add metadata
int trakLength = BitConverter.ToInt32(new ArraySegment<byte>(file, trakPosition - 4, 4).Reverse().ToArray(), 0);
var fileList = file.ToList();
fileList.InsertRange(trakPosition - 4 + trakLength, metadata);
file = fileList.ToArray();
////change length - tried this as well
//byte[] trakBytes = BitConverter.GetBytes(trakLength + metadata.Length).Reverse().ToArray();
//for (int i = 0; i < 4; i++)
// file[trakPosition - 4 + i] = trakBytes[i];
//find moov
int moovPosition = 0;
for (int a = 0; a < file.Length - moov.Length; a++)
{
for (int b = 0; b < moov.Length; b++)
{
if (file[a + b] != moov[b])
break;
if (b == moov.Length - 1)
moovPosition = a;
}
}
if (moovPosition == 0)
throw new FileLoadException();
//change length
int moovLength = BitConverter.ToInt32(new ArraySegment<byte>(file, moovPosition - 4, 4).Reverse().ToArray(), 0);
byte[] moovBytes = BitConverter.GetBytes(moovLength + metadata.Length).Reverse().ToArray();
for (int i = 0; i < 4; i++)
file[moovPosition - 4 + i] = moovBytes[i];
//find stco
int stcoPosition = 0;
for (int a = 0; a < file.Length - stco.Length; a++)
{
for (int b = 0; b < stco.Length; b++)
{
if (file[a + b] != stco[b])
break;
if (b == stco.Length - 1)
stcoPosition = a;
}
}
if (stcoPosition == 0)
throw new FileLoadException();
//modify entries
int stcoEntries = BitConverter.ToInt32(new ArraySegment<byte>(file, stcoPosition + 8, 4).Reverse().ToArray(), 0);
for (int a = stcoPosition + 12; a < stcoPosition + 12 + stcoEntries * 4; a += 4)
{
int entryLength = BitConverter.ToInt32(new ArraySegment<byte>(file, a, 4).Reverse().ToArray(), 0);
byte[] newEntry = BitConverter.GetBytes(entryLength + metadata.Length).Reverse().ToArray();
for (int b = 0; b < 4; b++)
file[a + b] = newEntry[b];
}
File.WriteAllBytes(outputFile, file);
}
private static byte[] HexStringToByteArray(string hex)
{
hex = hex.Replace(" ", "");
return Enumerable.Range(0, hex.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
.ToArray();
}
</byte></byte></byte></byte>The bytes are reversed because .mp4s seem to be Little Endian. I tried to also update the length of
trak
but that didn’t work either.