
Recherche avancée
Autres articles (34)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (5278)
-
Out of memory on ffmpeg when converting to H265
18 août 2017, par LionI’ve a bunch of video files, mostly H264. To save storage, I wrote a batch script, that converts all of them to H265 using ffmpeg. Problem : Some files cause ffmpeg to use ALL my memory (24 GB). Then it crashes (cause it try to allocate even more RAM), which stops the converting process.
I think that these files are corrupt in some kind. Because with other files, it works well with low memory consumption. Now I want to reject those broken ones, so that unattended converting is possible.
How is it possible to detect such corruption ? Can ffmpeg do this, or is a third party tool required ?
My ffmpeg call
set crf=20
set codec=265
ffmpeg -hide_banner -i "!fullSourcePath!" -c:v libx%codec% -crf %crf% "%targetPath%\!targetFileName!"mkvalidator can’t help
mkvalidator says that a corrupt file is valid :
mkvalidator.exe "V:\Filme\_LegacyFormat\22 Jump Street.mkv"
........................................................................................................................
WRN0D0: There are 5306 bytes of void data..
mkvalidator 0.5.0: the file appears to be valid
file created with libebml v1.3.0 + libmatroska v1.4.1 / mkvmerge v6.9.1 ('Blue Panther') 64bit built on Apr 18 2014 18:23:38eac3to331 can’t help, too
I found the tool eac3to331, which has a
check
flag. But it gave me no errors, although the tested file seems corrupt (cause my PC to crash after several minutes running ffmpeg)eac3to.exe -check "V:\Filme\_LegacyFormat\22 Jump Street.mkv"
MKV, 1 video track, 2 audio tracks, 1 subtitle track, 1:51:57, 24p /1.001
1: h264/AVC, English, 1920x808 24p /1.001 (240:101)
2: DTS, German, 5.1 channels, 1509kbps, 48kHz
3: DTS, English, 5.1 channels, 1509kbps, 48kHz
4: Subtitle (SRT), German
v01 Extracting video track number 1...
a02 Extracting audio track number 2...
a03 Extracting audio track number 3...
s04 Extracting subtitle track number 4...
Video track 1 contains 161039 frames.
eac3to processing took 1 minute, 26 seconds.
Done. -
Is avcodec_send_frame thread safe for a single AVFrame ?
22 juin 2024, par Александр АI'm doing video transcoding live stream. The H264 input stream from the usb camera, I decided to encode the same AVFrame in different threads for streaming x264 with low bitrate and for jpg snapshots, but at some points avcodec_send_frame is successful, at others it returns error -22, and sometimes even Segmentation fault.


What can be done about it ?


My snapshot handler is for example


int SnapshotEncode(int (*callback)(const char * topic, const uint8_t * buf, int lbuf), const char * topic)
{
 const AVCodec * pCdc = avcodec_find_encoder(AV_CODEC_ID_MJPEG);
 if (!pCdc)
 {
 fprintf(stderr, "ERROR find snapshot encoder for '%s'\n", avcodec_get_name(AV_CODEC_ID_MJPEG));
 return -1;
 }

 struct stEncoder_t * enc = EncoderNew("snapshot");
 if (!enc) return -2;

 int rt = 0;
 AVCodecContext * pCdcCtx = avcodec_alloc_context3(pCdc);
 if (!pCdcCtx)
 {
 PrintErrorAV("alloc snapshot an encoding context", (rt = AVERROR(ENOMEM)));
 return rt;
 }

 pCdcCtx->time_base = DEFAULT_TIME_BASE;
 pCdcCtx->pix_fmt = pCdcCtxInp->pix_fmt;
 pCdcCtx->height = pCdcCtxInp->height;
 pCdcCtx->width = pCdcCtxInp->width;

 if ((rt = avcodec_open2(pCdcCtx, pCdc, NULL)))
 {
 PrintErrorAV("open snapshot encoder", rt);
 goto END;
 }

 AVPacket * pPkt = av_packet_alloc();
 if (!pPkt)
 {
 PrintErrorAV("allocate snapshot AVPacket", (rt = AVERROR(ENOMEM)));
 goto END;
 }

 EncoderRun(enc, 1);
 if ((rt = sem_wait(&enc->sem)) < 0)
 fprintf(stderr, "ERROR lock encoder semaphore: %d %s\n", errno, strerror(errno));

 if (rt)
 {
 EncoderRun(enc, 0);
 pthread_barrier_wait(&stDec.bar);
 goto END;
 }

 if ((rt = avcodec_send_frame(pCdcCtx, stEnc.pFrm)))
 PrintErrorAV("snapshot encode send", rt);
 else if ((rt = avcodec_receive_packet(pCdcCtx, pPkt)))
 PrintErrorAV("snapshot encode receive", rt);

 EncoderRun(enc, 0);
 pthread_barrier_wait(&stDec.bar);

 if (rt == 0) callback(topic, pPkt->data, pPkt->size);

 av_packet_unref(pPkt);

END:
 EncoderFree(enc);
 if (pPkt) av_packet_free(&pPkt);
 if (pCdcCtx) avcodec_free_context(&pCdcCtx);

 return rt;
}




-
Paperclip geometry ignored
27 mars 2017, par ACIDSTEALTHI have a model called Snapshot, which represents a user-recorded video. I want to take the input video file and scale it to fit within a 720x720 box (ImageMagick documentation). I then want to capture some screenshots of the video to represent it in my app. These sizes are specified accordingly in my model.
I expect the output of this to be an
original
video with a maximum width of 720px (assuming it was recorded in landscape mode), alarge
JPG image with a maximum width of 540px, etc.When I attach the video file and save the model, the images and video file are processed but the result is not what I expected. The video file has a resolution of 960x720 and the images are all square (540x540, 360x360, etc).
I’m not sure if I’m doing something wrong or if this is just a bug with Paperclip. Here is my code :
class Snapshot < ApplicationRecord
has_attached_file :video,
styles: {
original: { geometry: "720x720", format: 'mp4' },
large: { geometry: "540x540", format: 'jpg' },
medium: { geometry: "360x360", format: 'jpg' },
thumb: { geometry: "180x180", format: 'jpg' }
},
default_url: "", processors: [:transcoder]
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
validates_attachment_size :video, less_than: 100.megabytes
endI have also tried adjusting the geometry to
720x720>
,540x540>
, etc. When I did this, the attachments’ resolution was unchanged, which seems to go completely against my understanding of how ImageMagick geometry works. I have numerous other models with image-only attachments that do not suffer from this issue.Here is a snippet from my
Gemfile.lock
so you can see which versions I am running :delayed_paperclip (3.0.1)
activejob (>= 4.2)
paperclip (>= 3.3)
paperclip (5.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (~> 0.3.0)
paperclip-av-transcoder (0.6.4)
av (~> 0.9.0)
paperclip (>= 2.5.2)
paperclip-optimizer (2.0.0)
image_optim (~> 0.19)
paperclip (>= 3.4)Update
I retried this with a video recorded in portrait mode (iPhone 6 front-facing webcam) and the video file’s output size was 720x720. The images were still square as before.