Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (8)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Qualité du média après traitement

    21 juin 2013, par

    Le bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
    Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)

Sur d’autres sites (4046)

  • 'avcodec_decode_video' of ffmpeg doesn't work

    1er février 2012, par sirupa

    i use vc++ express, and am going to get with ffmpeg..

    but with the 1st program i met a trouble.

    vc++ says 'identifier 'avcodec_decode_video' : identifier not found' on commpile process.

    i don't know why....

    next is waht i coded...
    .

    include "avcodec.h"

    include "avformat.h"

    include "swscale.h"

    int main(int argc, char *argv[])

    {
    av_register_all();

    AVFormatContext *pFormatCtx;

    // Open video file

    if(av_open_input_file(&pFormatCtx, argv[1], NULL, 0, NULL)!=0)

     return -1; // Couldn't open file

    // Retrieve stream information

    if(av_find_stream_info(pFormatCtx)<0)

       return -1; // Couldn't find stream information

    // Dump information about file onto standard error

    dump_format(pFormatCtx, 0, argv[1], 0);


    int i;

    AVCodecContext *pCodecCtx;

    // Find the first video stream

    int videoStream=-1;

    for(i=0; inb_streams; i++)

       if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {

       videoStream=i;

       break;

    }

    if(videoStream==-1)

       return -1; // Didn't find a video stream

    // Get a pointer to the codec context for the video stream

    pCodecCtx=pFormatCtx->streams[videoStream]->codec;

    AVCodec *pCodec;


    // Find the decoder for the video stream

    pCodec=avcodec_find_decoder(pCodecCtx->codec_id);

    if(pCodec==NULL) {

       fprintf(stderr, "Unsupported codec!\n");

       return -1; // Codec not found

    }

    // Open codec

    if(avcodec_open(pCodecCtx, pCodec)<0)

       return -1; // Could not open codec

    AVFrame *pFrame;

    // Allocate video frame

    pFrame=avcodec_alloc_frame();

       // Allocate an AVFrame structure

    AVFrame* pFrameRGB=avcodec_alloc_frame();

    if(pFrameRGB==NULL)

     return -1;

    uint8_t *buffer;

    int numBytes;

    // Determine required buffer size and allocate buffer

    numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,pCodecCtx->height);

    buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

    // Assign appropriate parts of buffer to image planes in pFrameRGB

    // Note that pFrameRGB is an AVFrame, but AVFrame is a superset

    // of AVPicture

    avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,pCodecCtx->width, pCodecCtx->height);

    int frameFinished;

    AVPacket packet;

    i=0;

    while(av_read_frame(pFormatCtx, &packet)>=0) {

       if(packet.stream_index==videoStream) {

    **// here makes compile error**

       avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,packet.data, packet.size);

       if(frameFinished) {

       img_convert((AVPicture *)pFram eRGB, PIX_FMT_RGB24, (AVPicture*)pFrame, pCodecCtx->pix_fmt,pCodecCtx->width, pCodecCtx->height);

        }
    av_free_packet(&packet);
    }
    av_free(buffer);

    av_free(pFrameRGB);

    av_free(pFrame);

    avcodec_close(pCodecCtx);

    av_close_input_file(pFormatCtx);


     return 0;

    }

  • How do I exit or kill a running OS process (FFMPEG) started with Node.js without crashing my app ?

    18 novembre 2022, par Alula Leakemariam

    I am developing an express application that starts FFMPEG through nodejs's child_process. The process starts, but when I try deleting specific processes by pid, the whole app crashes and has to be restarted.

    


    I start the stream with this :

    


    const { spawn, exec } = require("child_process");
const execFile = require("child_process").execFile;

function startStream(foo, url, bar) {
  const ls = spawn(`mkdir`, [`$foo`], {
    cwd: `path/to/working/dir`,
    stdio: "inherit",
  });

  const child = execFile(
    "ffmpeg",
    ["-i", url, "-hls_flags", "delete_segments", "-c", "copy", `path/to/file.m3u8`],
    { maxBuffer: Infinity },
    (error, stdout, stderr) => {
      if (error) {
        console.error("stderr: =============================", stderr);
        throw error;
      }
      console.log("stdout: ==========================", stdout);
    }
  );

  const checkProcesses = exec(`ps`, (error, stdout, stderr) => {
    if (error) {
      console.error("stderr: =============================", stderr);
      throw error;
    }
    console.log("stdout: ==========================", stdout);
  });

  return child.pid;
}

module.exports = startStream;


    


    The code below is the results of running the ps command to list the running processes, which lists ffmpeg as one of them. This will also show ffmpeg again for each time I run the function above.

    


       6394 pts/3    00:00:00 bash
 110129 pts/3    00:00:28 npm run start
 110140 pts/3    00:00:00 sh
 110141 pts/3    00:00:38 node
 136730 pts/3    00:00:00 node
 137148 pts/3    00:00:00 ffmpeg
 137358 pts/3    00:00:00 sh
 137359 pts/3    00:00:00 ps



    


    This will also start copying the FFMPEG files to the directory as expected. Afterwards, another endpoint will use the function below to delete the files created and (attempt to) kill the process :

    


    const { spawn, exec } = require("child_process");
const kill = require("tree-kill");

async function endStream(foo, bar, pid) {
  kill(pid, "SIGKILL");

  // Also tried this commented out code below with spawn and exec
  // const killProcessByPid = spawn("kill", ["-9", `${pid}`]);
  
  const ls = exec(`rm -rf  ${foo}`, {
    cwd: `./path/to/working/dir`,
  });
}
module.exports = endStream;



    


    I've tried a few variations but the result I get is usually along the lines of this :

    


    Exiting normally, received signal 15.&#xA;&#xA;    at ChildProcess.exithandler (node:child_process:402:12)&#xA;    at ChildProcess.emit (node:events:513:28)&#xA;    at maybeClose (node:internal/child_process:1100:16)&#xA;    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {&#xA;  code: 255,&#xA;  killed: false,&#xA;  signal: null,&#xA;  cmd: &#x27;ffmpeg -i <url>.m3u8 -hls_flags delete_segments -c copy path/to/file.m3u8&#x27;&#xA;}&#xA;[nodemon] app crashed - waiting for file changes before starting..&#xA;&#xA;</url>

    &#xA;

    I only started using exec/execFile/spawn after failing with libraries like fluent-ffmpeg and a few others, though it doesn't look like starting the process causes the same issues that exiting them do.

    &#xA;

    If there's anything else I can optimize while my code is up, i'd love to hear it. I'm not even sure if this code will have success with many ffmpeg processes running concurrently.

    &#xA;

    I am running this on linux (ubuntu) right now and eventually plan to deploy the server.

    &#xA;

  • ffmpeg filter complex error ( burning subtitles used overlay filter)

    8 septembre 2020, par jgkim0518

    I try to burn dvb subtitles, based image, on video used ffmpeg overlay filter. but I failed because wrong using filter complex.

    &#xA;

    It's my command line.

    &#xA;

    ./ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -hwaccel_device 0 \&#xA;-i input.ts \&#xA;-filter_complex "[v:0][s:3]overlay[overlay];[overlay]hwupload_cuda[base];[base]scale_npp=1920:1080[v1];[base]scale_npp=1920:1080[v2];[base]scale_npp=1280:720[v3];[base]scale_npp=720:480[v4];[base]scale_npp=480:360[v5]" \&#xA;-map "[v1]" -map 0:a -c:v hevc_nvenc -b:v 6000000 -maxrate 7000000 -bufsize 12000000 -g 15 -c:a libfdk_aac -ar 48000 -ac 2 -pkt_size 128000 -f mpegts test_1.ts \&#xA;-map "[v2]" -map 0:a -c:v h264_nvenc -an -b:v 4000000 -maxrate 5000000 -bufsize 8000000 -g 15 -f mpegts test_2.ts \&#xA;-map "[v3]" -map 0:a -c:v h264_nvenc -an -b:v 2500000 -maxrate 3500000 -bufsize 5000000 -g 15 -f mpegts test_3.ts \&#xA;-map "[v4]" -map 0:a -c:v h264_nvenc -an -b:v 1500000 -maxrate 2500000 -bufsize 3000000 -g 15 -f mpegts test_4.ts \&#xA;-map "[v5]" -map 0:a -c:v h264_nvenc -an -b:v 800000 -maxrate 1800000 -bufsize 2000000 -g 15 -f mpegts test_5.ts&#xA;

    &#xA;

    but I failed. It is error messages.

    &#xA;

    Input #0, mpegts, from &#x27;input.ts&#x27;:&#xA;Duration: N/A, start: 22881.964411, bitrate: N/A&#xA;  Program 1 &#xA;    Metadata:&#xA;      service_name    : Service01&#xA;      service_provider: FFmpeg&#xA;    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s&#xA;    Stream #0:1[0x101](ind): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s&#xA;    Stream #0:2[0x102](zho): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s&#xA;    Stream #0:3[0x103](kho): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s&#xA;    Stream #0:4[0x104]: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(top first, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc&#xA;    Stream #0:5[0x105](CHI): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:6[0x106](CHS): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:7[0x107](IND): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:8[0x108](THA): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:9[0x109](MAN): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:10[0x10a](MON): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:11[0x10b](BUR): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    Stream #0:12[0x10c](ENG): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)&#xA;    [mpegts @ 0x47cbd00] Invalid stream specifier: base.&#xA;    Last message repeated 17 times&#xA;    Stream specifier &#x27;base&#x27; in filtergraph description [v:0][s:3]overlay[overlay];[overlay]hwupload_cuda[base];[base]scale_npp=1920:1080[v1];[base]scale_npp=1920:1080[v2];[base]scale_npp=1280:720[v3];[base]scale_npp=720:480[v4];[base]scale_npp=480:360[v5] matches no streams.&#xA;

    &#xA;

    My plan is this.&#xA;enter image description here

    &#xA;

    How to do burn subtitle on video using filter complex, ffmpeg from this structure ?

    &#xA;