
Recherche avancée
Médias (3)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (58)
-
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 (7797)
-
x264 encoding severe quality loss
1er septembre 2020, par SolskGaerI used this repo to encode a mjpeg stream to a h264 one, but the output is not so good. The stream is a series of screenshot of an iPhone. In the output stream, even the lines between two items in the settings app are gone. How do I improve the output stream quality ?
Here is the code snippet that x264-go use to init an encoder


func NewEncoder(w io.Writer, opts *Options) (e *Encoder, err error) {
 e = &Encoder{}

 e.w = w
 e.pts = 0
 e.opts = opts

 e.csp = x264c.CspI420

 e.nals = make([]*x264c.Nal, 3)
 e.img = NewYCbCr(image.Rect(0, 0, e.opts.Width, e.opts.Height))

 param := x264c.Param{}

 if e.opts.Preset != "" && e.opts.Profile != "" {
 ret := x264c.ParamDefaultPreset(&param, e.opts.Preset, e.opts.Tune)
 if ret < 0 {
 err = fmt.Errorf("x264: invalid preset/tune name")
 return
 }
 } else {
 x264c.ParamDefault(&param)
 }

 param.IWidth = int32(e.opts.Width)
 param.IHeight = int32(e.opts.Height)

 param.ICsp = e.csp
 param.BVfrInput = 0
 param.BRepeatHeaders = 1
 param.BAnnexb = 1

 param.ILogLevel = e.opts.LogLevel

 if e.opts.FrameRate > 0 {
 param.IFpsNum = uint32(e.opts.FrameRate)
 param.IFpsDen = 1

 param.IKeyintMax = int32(e.opts.FrameRate)
 param.BIntraRefresh = 1
 }

 if e.opts.Profile != "" {
 ret := x264c.ParamApplyProfile(&param, e.opts.Profile)
 if ret < 0 {
 err = fmt.Errorf("x264: invalid profile name")
 return
 }
 }

 // Allocate on create instead while encoding
 var picIn x264c.Picture
 ret := x264c.PictureAlloc(&picIn, e.csp, int32(e.opts.Width), int32(e.opts.Height))
 if ret < 0 {
 err = fmt.Errorf("x264: cannot allocate picture")
 return
 }
 e.picIn = picIn
 defer func() {
 // Cleanup if intialization fail
 if err != nil {
 x264c.PictureClean(&picIn)
 }
 }()

 e.e = x264c.EncoderOpen(&param)
 if e.e == nil {
 err = fmt.Errorf("x264: cannot open the encoder")
 return
 }

 ret = x264c.EncoderHeaders(e.e, e.nals, &e.nnals)
 if ret < 0 {
 err = fmt.Errorf("x264: cannot encode headers")
 return
 }

 if ret > 0 {
 b := C.GoBytes(e.nals[0].PPayload, C.int(ret))
 n, er := e.w.Write(b)
 if er != nil {
 err = er
 return
 }

 if int(ret) != n {
 err = fmt.Errorf("x264: error writing headers, size=%d, n=%d", ret, n)
 }
 }

 return
}



and the encoder option is defined as


opts := &x264.Options{
 Width: int(width)/2*2,
 Height: int(height)/2*2,
 FrameRate: 15,
 Tune: "zerolatency",
 Preset: "medium",
 Profile: "baseline",
 LogLevel: x264.LogNone,
 }



And I also used ffmpeg(though the api is pretty old)


package screencast

import (

 /*
 #include 
 #include 
 #include 
 #include 
 #include <libavcodec></libavcodec>avcodec.h>
 #include <libavformat></libavformat>avformat.h>
 #include <libavutil></libavutil>avutil.h>
 #include <libavutil></libavutil>opt.h>
 #include <libavutil></libavutil>channel_layout.h>
 #include <libavutil></libavutil>common.h>
 #include <libavutil></libavutil>imgutils.h>
 #include <libavutil></libavutil>mathematics.h>
 #include <libavutil></libavutil>samplefmt.h>

 typedef struct {
 int w, h;
 int pixfmt;
 char *preset[2];
 char *profile;
 int bitrate;
 int got;
 AVCodec *c;
 AVCodecContext *ctx;
 AVFrame *f;
 AVPacket pkt;
 } h264enc_t;

 static int h264enc_new(h264enc_t *m) {
 m->c = avcodec_find_encoder(AV_CODEC_ID_H264);
 m->ctx = avcodec_alloc_context3(m->c);
 m->ctx->width = m->w;
 m->ctx->height = m->h;
 m->ctx->pix_fmt = m->pixfmt;
 m->ctx->time_base = (AVRational){1,10};
 av_opt_set(m->ctx->priv_data, "preset", "slow", 0);
 av_opt_set(m->ctx->priv_data, "tune", "zerolatency", 0);
 av_opt_set(m->ctx->priv_data, "profile", "baseline", 0);
 av_opt_set(m->ctx->priv_data, "crf", "18.0.", 0);
 m->f = av_frame_alloc();
 m->f->format = m->ctx->pix_fmt;
 m->f->width = m->ctx->width;
 m->f->height = m->ctx->height;
 avcodec_open2(m->ctx, m->c, NULL);
 return av_image_alloc(m->f->data, m->f->linesize, m->ctx->width, m->ctx->height, m->ctx->pix_fmt, 32);
 }

 */
 "C"
 "errors"
 "image"
 "unsafe"
 //"log"
)

type H264Encoder struct {
 m C.h264enc_t
 Header []byte
 Pixfmt image.YCbCrSubsampleRatio
 W, H int
 pts int
}

func NewH264Encoder(w, h int) (m *H264Encoder, err error) {
 m = &H264Encoder{}
 m.m.w = (C.int)(w)
 m.m.h = (C.int)(h)
 m.W = w
 m.H = h
 m.Pixfmt = image.YCbCrSubsampleRatio420
 m.m.pixfmt = C.AV_PIX_FMT_YUV420P
 r := C.h264enc_new(&m.m)
 if int(r) < 0 {
 err = errors.New("open encoder failed")
 return
 }
 return
}

func (m *H264Encoder) Encode(img *image.YCbCr) (data []byte, err error) {
 var f *C.AVFrame
 if img == nil {
 f = nil
 } else {
 if img.SubsampleRatio != m.Pixfmt {
 err = errors.New("image pixfmt not match")
 return
 }
 if img.Rect.Dx() != m.W || img.Rect.Dy() != m.H {
 err = errors.New("image size not match")
 return
 }
 f = m.m.f
 f.data[0] = (*C.uint8_t)(unsafe.Pointer(&img.Y[0]))
 f.data[1] = (*C.uint8_t)(unsafe.Pointer(&img.Cb[0]))
 f.data[2] = (*C.uint8_t)(unsafe.Pointer(&img.Cr[0]))
 f.linesize[0] = (C.int)(img.YStride)
 f.linesize[1] = (C.int)(img.CStride)
 f.linesize[2] = (C.int)(img.CStride)
 }

 C.av_init_packet(&m.m.pkt)
 m.m.pkt.data = nil
 m.m.pkt.size = 0
 f.pts = (C.longlong)(m.pts)
 m.pts++
 r := C.avcodec_encode_video2(m.m.ctx, &m.m.pkt, f, &m.m.got)
 defer C.av_packet_unref(&m.m.pkt)
 if int(r) < 0 {
 err = errors.New("encode failed")
 return
 }
 if m.m.got == 0 {
 err = errors.New("no picture")
 return
 }
 if m.m.pkt.size == 0 {
 err = errors.New("packet size == 0")
 return
 }

 data = make([]byte, m.m.pkt.size)
 C.memcpy(
 unsafe.Pointer(&data[0]),
 unsafe.Pointer(m.m.pkt.data),
 (C.size_t)(m.m.pkt.size),
 )
 return data, nil
}



but got the same output. However, when I use the ffmpeg binary, the result was pretty good, so I guess I set wrong parameters, but I don't know which.
Any suggestion would be appreciated. If you have better way to achieve this, I'll appreciate it.


For your information : I must do this using golang.




-
Fastest way to combine an image and audio file to make a video using ffmpeg
10 septembre 2020, par Ritik Sahu Studenti am using ffmpeg to combine an image and audio to make video with this command from my python program


process = subprocess.Popen('ffmpeg -loop 1 -i "{picture}" -i "{audio}" -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest "{out_path}"'.format(picture=picture, audio=audio, out_path=out_path), stdout=subprocess.PIPE, shell=False)



but it is taking very long almost 30-45 minutes on my pc with specifications 1GB Ram and intel xenon processor. is there any way to make this process faster
i am ready to compromise the quality (decent).


-
What is the commmand line to record destop screen with watermark using ffmpeg ?
11 septembre 2020, par Yong JuI tried to record screen using ffmpeg commmand line. So, I have complete it using this commmand.
ffmpeg.exe -rtbufsize 1500M -f -y -rtbufsize 100M -f gdigrab -t 00:02:00 -framerate 30 0 0 -probesize 10M 1920 1080 -draw_mouse 1 -i desktop -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -crf 30 -pix_fmt yuv420p output.avi".


Now, I want to add watermark while recording video.
If you have good experience this field, Please give me good advice.
Thanks for your attention.
Sincerely.