Recherche avancée

Médias (91)

Autres articles (86)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

  • Qu’est ce qu’un masque de formulaire

    13 juin 2013, par

    Un masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
    Chaque formulaire de publication d’objet peut donc être personnalisé.
    Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
    Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (11596)

  • ffmpeg - Streaming rtsp data to local mp4 file

    15 juillet 2017, par Pankhuri Agarwal

    How can I save live streaming data from a local camera transported by rtsp to my local memory in a .mp4 format.

    I am using Ubuntu 16.04 LTS and tried using ffmpeg 3.3 but nothing seemed to work properly.

    The goal will be to provide live feed by mp4 by html5 and perform some modification on mp4 data.

    Can anyone suggest how to make ffmpeg work or any other way ?

  • How to Convert video into mp3 format using ffmpeg in nodejs and angular and then save converted audio into the database

    2 septembre 2021, par Amir Shahzad

    This is nodejs server side file

    


    const express = require('express');
const ffmpeg  = require('fluent-ffmpeg');
const fileUpload = require('express-fileupload');
const mongoose = require('mongoose');
const cors   = require('cors')
const app = express();
const Video = require('./models/video');
mongoose.connect('mongodb://localhost:27017/YoutubeApp', {
    useNewUrlParser: true,
    useUnifiedTopology: true,
});
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error'));
db.once('open', () => {
   console.log('Data Base Connected Successfully!');
});

app.use(fileUpload({
   useTempFiles: true,
   tempFileDir: 'temp/'
}));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors({ origin: 'http://localhost:4200' }));


ffmpeg.setFfmpegPath('/usr/bin/ffmpeg');

app.post('/mp4tomp3', (req, res) => {
  convertdata = req.body;
  console.log('path of innput is', req.body);
  function convert(input, output, callback) {
     ffmpeg(input)
         .output(output)
         .on('end', function() {                    
             console.log('conversion ended');
             callback(null);
           }).on('error', function(err){
              console.log('error: ', err.code, err.msg);
              callback(err);
           }).run();
      }
     convert(convertdata, './temp/output.mp3', function(err){
        if(!err) {
          console.log('conversion complete');

 
     }
 })

 app.listen(3000, () => {
    console.log('Server Start On Port 3000')
 })


    


    In Convert function i not know how i can get input by the user i'm new in angular Please anyone can solve this out thanks in advance

    


    This is video model file

    


    const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const videoSchema = new Schema({
    mp4: String,
});
module.exports = mongoose.model("Videos", videoSchema);


    


    **This is Typescript code in angular client side that handle user input and select video **

    


    import { ThrowStmt } from '@angular/compiler';
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { VideoConversionService } from 'src/services/video-conversion.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {

   submitted =false;
   form! : FormGroup
   data:any

   constructor(private formBuilder: FormBuilder,
       private videoService: VideoConversionService){}

   creatForm(){
    this.form = this.formBuilder.group({
    mp4: ['', Validators.required],
  });
  }
   ngOnInit(): void {
   this.creatForm();

  }


  convertVideo(){
    this.submitted = true
    this.videoService.conversion(this.form.value).subscribe(res => {
    this.data = res;
 })
 }

 }


    


    I do not know how to create logic to do that (convert video into audio using angular framework)

    


    This is app.component.html file where i want to get video from the user using input field

    


    <div class="container">&#xA;   <h1>Video Proccessing App</h1>&#xA;   <form>&#xA;     <input type="file" formcontrolname="mp4" />&#xA;     <input type="submit" value="Convert" />&#xA;  </form>&#xA;</div>&#xA;

    &#xA;

    &#xA;

    But my code is not working and video is not converting into audio

    &#xA;

    This is my video service file where i calling nodejs api to perform the task

    &#xA;

    import { Injectable } from &#x27;@angular/core&#x27;;&#xA;import { HttpClient  } from &#x27;@angular/common/http&#x27;;&#xA;@Injectable({&#xA;   providedIn: &#x27;root&#x27;&#xA;})&#xA;export class VideoConversionService {&#xA;&#xA;constructor(private httpClient: HttpClient) { }&#xA;&#xA;conversion(data: any){&#xA;   return this.httpClient.post(&#x27;http://localhost:3000/mp4tomp3&#x27;, data)&#xA;}&#xA;}&#xA;

    &#xA;

    Please anyone can solve my problem Thanks in advance

    &#xA;

  • How to save h264 frames as jpeg images using ffmpeg ?

    17 août 2020, par Matthew Czarnek

    I would like to save thumbnails from a h264 stream that I'm turning into ffmpeg avpackets as jpegs.

    &#xA;

    I'm started with a h264 AVPacket (iframe) and decode it into an AVFrame using avcodec_send_packet/avcodec_receive_frame. Now trying to go from AVFrame and convert into AVPacket using avcodec_send_frame/avcodec_receive_packet

    &#xA;

    I can convert to png instead jpg, though I do get a the video looking like it's outputting three separate frames squeezed side by side into one. Wondering if it's one frame is R, next G, and finally B. I'm not sure, clearly I'm doing something wrong there. I figured it's possible it's the png encoder and I don't need it, so let's get jpg working first. But jpg is outputting unopenable files.

    &#xA;

    Any advice ?

    &#xA;

    Here is my code :

    &#xA;

    int output_thumbnails(AVPacket* video_packet)&#xA;{&#xA;    char png_file_name[max_chars_per_filename];&#xA;    char thumbnail_id_char[10];&#xA;    _itoa_s(thumbnail_id, thumbnail_id_char, 10);&#xA;    strcpy_s(png_file_name, max_chars_per_filename, time_stamped_filepath);&#xA;    strcat_s(png_file_name, max_chars_per_filename, time_stamped_filename);&#xA;    strcat_s(png_file_name, max_chars_per_filename, thumbnail_id_char);&#xA;    strcat_s(png_file_name, max_chars_per_filename, ".jpg");&#xA;    thumbnail_id&#x2B;&#x2B;;&#xA;&#xA;    int error_code = send_AVPacket_to_videocard(video_packet, av_codec_context_RTSP);&#xA;&#xA;    //if (error_code == AVERROR_EOF)&#xA;    //{&#xA;    //  //  error_code = videocard_to_PNG(png_file_name, av_codec_context_RTSP, av_codec_RTSP);&#xA;    //}&#xA;    if (error_code == AVERROR(EAGAIN)) //send packets to videocard until function returns EAGAIN&#xA;    {&#xA;        error_code = videocard_to_PNG(png_file_name, av_codec_context_RTSP);&#xA;&#xA;        //EAGAIN means that the video card buffer is ready to have the png pulled off of it&#xA;        if (error_code == AVERROR_EOF)&#xA;        {&#xA;            //  error_code = videocard_to_PNG(png_file_name, av_codec_context_RTSP, av_codec_RTSP);&#xA;        }&#xA;        else if (error_code == AVERROR(EAGAIN))&#xA;        {&#xA;&#xA;        }&#xA;        else&#xA;        {&#xA;            deal_with_av_errors(error_code, __LINE__, __FILE__);&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        deal_with_av_errors(error_code, __LINE__, __FILE__);&#xA;    }&#xA;    &#xA;    return 0;&#xA;}&#xA;

    &#xA;

    VideoThumbnailGenerator.h :&#xA;#include "VideoThumbnailGenerator.h"

    &#xA;

    bool decoder_context_created = false;&#xA;bool encoder_context_created = false;&#xA;&#xA;AVCodecContext* h264_decoder_codec_ctx;&#xA;AVCodecContext* thumbnail_encoder_codec_ctx;&#xA;&#xA;int send_AVPacket_to_videocard(AVPacket* packet, AVCodecContext* codec_ctx)&#xA;{&#xA;    if(!decoder_context_created)&#xA;    {&#xA;        AVCodec* h264_codec = avcodec_find_decoder(codec_ctx->codec_id);&#xA;        h264_decoder_codec_ctx = avcodec_alloc_context3(h264_codec);&#xA;&#xA;        h264_decoder_codec_ctx->width = codec_ctx->width;&#xA;        h264_decoder_codec_ctx->height = codec_ctx->height;&#xA;        h264_decoder_codec_ctx->pix_fmt = AV_PIX_FMT_RGB24;&#xA;        h264_decoder_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;        h264_decoder_codec_ctx->skip_frame = AVDISCARD_NONINTRA;//AVDISCARD_NONREF;//AVDISCARD_NONINTRA;&#xA;        &#xA;        h264_decoder_codec_ctx->time_base.num = 1;&#xA;        h264_decoder_codec_ctx->time_base.den = 30;&#xA;&#xA;        h264_decoder_codec_ctx->extradata = codec_ctx->extradata;&#xA;        h264_decoder_codec_ctx->extradata_size = codec_ctx->extradata_size;&#xA;        &#xA;        int error_code = avcodec_open2(h264_decoder_codec_ctx, h264_codec, NULL);&#xA;        if (!h264_codec) {&#xA;            return -1;&#xA;        }&#xA;&#xA;        if (error_code &lt; 0)&#xA;        {&#xA;            return error_code;&#xA;        }&#xA;        decoder_context_created = true;&#xA;    }&#xA;&#xA;    &#xA;    //use hardware decoding to decode video frame&#xA;    int error_code = avcodec_send_packet(h264_decoder_codec_ctx, packet);&#xA;    if(error_code == AVERROR(EAGAIN))&#xA;    {&#xA;        return AVERROR(EAGAIN);&#xA;    }&#xA;    if(error_code&lt;0)&#xA;    {&#xA;        printf("Error: Could not send packet to video card");&#xA;        return error_code;&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;int videocard_to_PNG(char *png_file_path, AVCodecContext* codec_ctx)&#xA;{&#xA;    if (!encoder_context_created)&#xA;    {&#xA;        //AVCodec* thumbnail_codec = avcodec_find_encoder(AV_CODEC_ID_PNG);&#xA;        AVCodec* thumbnail_codec = avcodec_find_encoder(AV_CODEC_ID_JPEG2000);&#xA;        thumbnail_encoder_codec_ctx = avcodec_alloc_context3(thumbnail_codec);&#xA;&#xA;        thumbnail_encoder_codec_ctx->width = 128;&#xA;        thumbnail_encoder_codec_ctx->height = (int)(((float)codec_ctx->height/(float)codec_ctx->width) * 128);&#xA;        thumbnail_encoder_codec_ctx->pix_fmt = AV_PIX_FMT_RGB24; //AV_PIX_FMT_YUVJ420P&#xA;        thumbnail_encoder_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;&#xA;        thumbnail_encoder_codec_ctx->time_base.num = 1;&#xA;        thumbnail_encoder_codec_ctx->time_base.den = 30;&#xA;&#xA;        bool thread_check = thumbnail_encoder_codec_ctx->thread_type &amp; FF_THREAD_FRAME;&#xA;        bool frame_threads_check = thumbnail_encoder_codec_ctx->codec->capabilities &amp; AV_CODEC_CAP_FRAME_THREADS;&#xA;        &#xA;        int error_code = avcodec_open2(thumbnail_encoder_codec_ctx, thumbnail_codec, NULL);&#xA;        if (!thumbnail_codec) {&#xA;            return -1;&#xA;        }&#xA;&#xA;        if (error_code &lt; 0)&#xA;        {&#xA;            return error_code;&#xA;        }&#xA;        encoder_context_created = true;&#xA;    }&#xA;    &#xA;    AVFrame* thumbnail_frame = av_frame_alloc();&#xA;    AVPacket* thumbnail_packet = av_packet_alloc();&#xA;    //av_init_packet(png_packet);&#xA;    int error_code = avcodec_receive_frame(h264_decoder_codec_ctx, thumbnail_frame);&#xA;&#xA;    //check for errors everytime&#xA;    //note EAGAIN errors won&#x27;t get here since they won&#x27;t get past while&#xA;    if (error_code &lt; 0 &amp;&amp; error_code != AVERROR(EAGAIN))&#xA;    {&#xA;        printf("Error: Could not get frame from video card");&#xA;        return error_code;&#xA;    }&#xA;    //empty buffer if there are any more frames to pull (there shouldn&#x27;t be)&#xA;    //while(error_code != AVERROR(EAGAIN))&#xA;    //{&#xA;    //  //check for errors everytime&#xA;    //  //note EAGAIN errors won&#x27;t get here since they won&#x27;t get past while&#xA;    //  if (error_code &lt; 0)&#xA;    //  {&#xA;    //      printf("Error: Could not get frame from video card");&#xA;    //      return error_code;&#xA;    //  }&#xA;    //  &#xA;    //  error_code = avcodec_receive_frame(h264_decoder_codec_ctx, png_frame);&#xA;    //}&#xA;&#xA;    //now we convert back to AVPacket, this time one holding PNG info, so we can store to file&#xA;    error_code = avcodec_send_frame(thumbnail_encoder_codec_ctx, thumbnail_frame);&#xA;&#xA;    if (error_code >= 0) {&#xA;        error_code = avcodec_receive_packet(thumbnail_encoder_codec_ctx, thumbnail_packet);&#xA;&#xA;        FILE* out_PNG;&#xA;&#xA;        errno_t err = fopen_s(&amp;out_PNG, png_file_path, "wb");&#xA;        if (err == 0) {&#xA;            fwrite(thumbnail_packet->data, thumbnail_packet->size, 1, out_PNG);&#xA;        }&#xA;        fclose(out_PNG);&#xA;&#xA;    }&#xA;    return error_code;&#xA;}&#xA;

    &#xA;