Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (52)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (6418)

  • 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;

  • Trying to save frames as colored image using Ffmpeg in C++

    2 septembre 2021, par Tolga

    I am new to FFmpeg and I am trying to save the video frames as colored images. I have achieved saving them as grayscale using Netpbm, however, I need to save the frames as colored. I have tried implementing the code in this link.

    &#xA;

    However, I get an error :

    &#xA;

    &#x27;Exception thrown at 0x00E1FC4F (swscale-5.dll) in VideoDecoding2.exe:&#xA; 0xC0000005: Access violation writing location 0xCCCCCCCC.&#x27;&#xA;

    &#xA;

    Is there any way to improve this code or another way to save frames as colored ?

    &#xA;

    Here is my code below.

    &#xA;

      &#xA;
    • src_pix_fmt is AV_PIX_FMT_YUV420p.
    • &#xA;

    • dst_pix_fmt is AV_PIX_FMT_RGB24.
    • &#xA;

    &#xA;

    src_pix_fmt = avcc->pix_fmt;&#xA;&#xA;src_width = avcc->width;&#xA;src_height = avcc->height;&#xA;&#xA;dst_width = src_width;&#xA;dst_height = src_height;&#xA;&#xA;numBytes = av_image_get_buffer_size(dst_pix_fmt, dst_width, dst_height, 0);&#xA;&#xA;buffer = (uint8_t*)av_malloc(numBytes);&#xA;&#xA;if ((ret = av_image_alloc(src_data, src_linesize, src_width, src_height, src_pix_fmt, 16)) &lt; 0)&#xA;{&#xA;    printf("Couldn&#x27;t allocate source image.\n");&#xA;    return 0;&#xA;}&#xA;&#xA;av_image_fill_arrays(frameRGB->data, frameRGB->linesize, buffer, dst_pix_fmt, dst_width, dst_height, 0);&#xA;&#xA;while (av_read_frame(avfc, packet) >= 0)&#xA;{&#xA;    ret = avcodec_send_packet(avcc, packet);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        printf("Packets could not supplied to decoder.\n");&#xA;        return -1;&#xA;    }&#xA;&#xA;    ret = avcodec_receive_frame(avcc, frame);&#xA;    printf("%d", ret);&#xA;&#xA;    if (packet->stream_index == videoStream)&#xA;    {&#xA;        sws_ctx = sws_getContext(src_width, src_height, src_pix_fmt,&#xA;            dst_width, dst_height, dst_pix_fmt,&#xA;            SWS_BILINEAR, NULL, NULL, NULL);&#xA;&#xA;        if (!sws_ctx)&#xA;        {&#xA;            printf("Cannot create scale context for conversion\n"&#xA;                "fmt:%s s:%dx%d --> fmt:%s s:%dx%d\n",&#xA;                av_get_pix_fmt_name(src_pix_fmt), src_width, src_height,&#xA;                av_get_pix_fmt_name(dst_pix_fmt), dst_width, dst_height);&#xA;            return 0;&#xA;        }&#xA;&#xA;        sws_scale(sws_ctx, (const uint8_t* const*)frame->data, frame->linesize, 0, frame->height, dst_data, dst_linesize);&#xA;&#xA;        FILE* f;&#xA;        char szFilename[32];&#xA;        int y;&#xA;&#xA;        snprintf(szFilename, sizeof(szFilename), "frame%d.ppm", avcc->frame_number);&#xA;        fopen_s(&amp;f, szFilename, "wb");&#xA;        &#xA;        if (f == NULL)&#xA;        {&#xA;            printf("Couldn&#x27;t open file.\n");&#xA;            return 0;&#xA;        }&#xA;        &#xA;        fprintf(f, "P6\n%d %d\n255\n", dst_width, dst_height);&#xA;&#xA;        for (y = 0; y &lt; dst_height; y&#x2B;&#x2B;)&#xA;            fwrite(frameRGB->data[0] &#x2B; y * frameRGB->linesize[0], 1, dst_width * 3, f);&#xA;        &#xA;        fclose(f);&#xA;    }&#xA;}&#xA;

    &#xA;

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

    2 septembre 2021, par Amir Shahzad

    This is nodejs server side code

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const ffmpeg  = require(&#x27;fluent-ffmpeg&#x27;);&#xA;const fileUpload = require(&#x27;express-fileupload&#x27;);&#xA;const mongoose = require(&#x27;mongoose&#x27;);&#xA;const cors   = require(&#x27;cors&#x27;)&#xA;const app = express();&#xA;const Video = require(&#x27;./models/video&#x27;);&#xA;mongoose.connect(&#x27;mongodb://localhost:27017/YoutubeApp&#x27;, {&#xA;    useNewUrlParser: true,&#xA;    useUnifiedTopology: true,&#xA;});&#xA;const db = mongoose.connection;&#xA;db.on(&#x27;error&#x27;, console.error.bind(console, &#x27;connection error&#x27;));&#xA;db.once(&#x27;open&#x27;, () => {&#xA;   console.log(&#x27;Data Base Connected Successfully!&#x27;);&#xA;});&#xA;&#xA;app.use(fileUpload({&#xA;   useTempFiles: true,&#xA;   tempFileDir: &#x27;temp/&#x27;&#xA;}));&#xA;app.use(express.json());&#xA;app.use(express.urlencoded({ extended: true }));&#xA;app.use(cors({ origin: &#x27;http://localhost:4200&#x27; }));&#xA;&#xA;&#xA;ffmpeg.setFfmpegPath(&#x27;/usr/bin/ffmpeg&#x27;);&#xA;&#xA;app.post(&#x27;/mp4tomp3&#x27;, (req, res) => {&#xA;const data = new Video({&#xA;     mp4: req.body.mp4&#xA;});&#xA;res.contentType(&#x27;video/avi&#x27;);&#xA;res.attachment(&#x27;output.mp3&#x27;);&#xA;req.files.mp4val.mv("temp/" &#x2B; req.body, function(err) {&#xA;    if(err){&#xA;        res.sendStatus(500).send(err)&#xA;    }else{&#xA;        console.log("Fiel Uploaded Successfully.!");&#xA;    }&#xA;});&#xA;// Convertin Mp4 To Avi&#xA;ffmpeg(&#x27;temp/&#x27; &#x2B; req.files.mp4val.mp4)&#xA;.toFormat(&#x27;mp3&#x27;)&#xA;.on(&#x27;end&#x27;, function() {&#xA;    console.log(&#x27;Done&#x27;);&#xA;})&#xA;.on(&#x27;error&#x27;, function(err){&#xA;    console.log(&#x27;An Error Occured&#x27; &#x2B; err.message)&#xA;})&#xA; .pipe(res, {end: true})&#xA; })&#xA;&#xA; app.listen(3000, () => {&#xA;    console.log(&#x27;Server Start On Port 3000&#x27;)&#xA; })&#xA;

    &#xA;

    Here i want to get input from the user with input tag and then want to convert video into audio and save into the database but i not know how i can do this

    &#xA;

    This is video model file

    &#xA;

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

    &#xA;

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

    &#xA;

    import { ThrowStmt } from &#x27;@angular/compiler&#x27;;&#xA;import { Component, OnInit } from &#x27;@angular/core&#x27;;&#xA;import { FormBuilder, FormGroup, Validators } from &#x27;@angular/forms&#x27;;&#xA;import { VideoConversionService } from &#x27;src/services/video-conversion.service&#x27;;&#xA;&#xA;@Component({&#xA;  selector: &#x27;app-root&#x27;,&#xA;  templateUrl: &#x27;./app.component.html&#x27;,&#xA;  styleUrls: [&#x27;./app.component.css&#x27;]&#xA;})&#xA;export class AppComponent implements OnInit {&#xA;&#xA;   submitted =false;&#xA;   form! : FormGroup&#xA;   data:any&#xA;&#xA;   constructor(private formBuilder: FormBuilder,&#xA;       private videoService: VideoConversionService){}&#xA;&#xA;   creatForm(){&#xA;    this.form = this.formBuilder.group({&#xA;    mp4: [&#x27;&#x27;, Validators.required],&#xA;  });&#xA;  }&#xA;   ngOnInit(): void {&#xA;   this.creatForm();&#xA;&#xA;  }&#xA;&#xA;&#xA;  convertVideo(){&#xA;    this.submitted = true&#xA;    this.videoService.conversion(this.form.value).subscribe(res => {&#xA;    this.data = res;&#xA; })&#xA; }&#xA;&#xA; }&#xA;

    &#xA;

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

    &#xA;

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

    &#xA;

    <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;