Recherche avancée

Médias (91)

Autres articles (48)

  • 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. (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • 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. (...)

Sur d’autres sites (7212)

  • ffmpeg won't exit normally with SIGINT

    2 mars 2021, par ntstlkr

    I'm trying to record video with ffmpeg and all works fine when I call stopRecord() function inside timeout :

    


    frame=  147 fps= 18 q=-1.0 Lsize=     290kB time=00:00:09.91 bitrate= 239.8kbits/s speed=1.24x    
video:129kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 
2.159774%
[aac @ 0x55e825dbdc40] 
Qavg: 241.892
Exiting normally, received signal 2.
SIGINT
Recording process exit, code: 255, signal: null
Recording stopped


    


    But ffmpeg process won't exit and stays alive when I call stopRecord() function on API request inside express router.

    


    // here I create child process and try to close it in timeout which works.
export async function startRecord(producers: any, router: any, folderName: string, fileName: string) {
const sdp = `v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio ${ports[0]} RTP/AVPF 111
a=rtcp:${ports[0] + 1}
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
m=video ${ports[1]} RTP/AVPF 125
a=rtcp:${ports[1] + 1}
a=rtpmap:125 H264/90000
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f`;

const cmdArgStr = [
    "-protocol_whitelist pipe,rtp,udp",
    "-fflags +genpts",
    "-f sdp",
    "-i pipe:0",
    "-map 0:a:0 -c:a aac",
    "-map 0:v:0 -c:v copy",
    "-f mp4 -strict experimental",
    `-y recording/${folderName}/${fileName}.mp4`,
].join(" ").trim();

let process = spawn('ffmpeg', cmdArgStr.split(/\s+/));

process.stdin.write(sdp);
process.stdin.end();

process.on("error", (err: string) => {
    console.log('error');
    console.error("Recording process error:", err);
});

process.on("exit", (code: string, signal: string) => {
    process.kill('SIGINT');
    console.log('SIGINT');
    console.log("Recording process exit, code: %d, signal: %s", code, signal);

    if (!signal || signal === "SIGINT") {


           console.log("Recording stopped");
        } else {
            console.warn(
                "Recording process didn't exit cleanly, output file might be corrupt"
            );
        }
    });

    process.stderr.on("data", (chunk: string) => {
        chunk
            .toString()
            .split(/\r?\n/g)
            .filter(Boolean)
            .forEach(async (line: any) => {
                console.log(line);
                if (line.startsWith("ffmpeg version")) {
                    for (const consumer of consumers) {
                        await consumer.resume();
                    }
                }
            });
    });

    // this works!!
    setTimeout(() => {
        stopRecord(process);
    }, 10000);


    return process;
}

// this not works!! I call this function externally inside express router on API request
export function stopRecord(process: any) {
    process.kill('SIGINT');
}


    


    Linux process stays alive when I call stopRecord() inside express router, but property "killed" of process marked as true. It's only works when I send "SIGKILL" inside express router. I need to exit normally, because ffmpeg needs to save mp4 metadata.

    


    So the general question is : Why stopRecord function works inside timeout even with "SIGINT" code, but it doesn't when I call this function externally inside express router. Only "SIGKILL" works when I call stopRecord() inside express router.

    


    Renaming my "process" field doesn't help.

    


    I really don't understand why the same function works different inside timeout and inside express router. And I very thankful for any advice !

    


    I'm using node, typescript and express.

    


  • ffmpeg : stream -> edit -> stream ERROR : av_interleaved_write_frame() : Operation not permitted Error writing trailer of rtmps

    14 février 2021, par Yurii Kyparus

    I'm reading the horizontal hls stream, placing it in the middle of the vertical layout.

    


    

    

     ffmpeg  -i "https://......a1f6039622.m3u8" -vf "pad=iw:2*trunc(iw*16/18):(ow-iw)/2:(oh-ih)/2,setsar=1" -c:v libx264 -pix_fmt yuv420p -profile:v main -c:a aac  -f flv -flvflags no_duration_filesize  rtmps://...e.live-video.net:443/app/secret_key

    


    


    

Getting next error :


    

    

    WriteN, RTMP send error 32 (129 bytes)54kB time=00:00:10.22 bitrate=1164.8kbits/s speed=3.81x
WriteN, RTMP send error 0 (91 bytes)
WriteN, RTMP send error 9 (42 bytes)
av_interleaved_write_frame(): Operation not permitted
Error writing trailer of rtmps://94e...net:443/app/...gSK: Operation not permitted
frame=  308 fps= 13 q=29.0 Lsize=    1535kB time=00:00:10.80 bitrate=1164.0kbits/s speed=0.44x
video:1396kB audio:177kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x7ff3c8888000] frame I:2     Avg QP:12.40  size: 46750
[libx264 @ 0x7ff3c8888000] frame P:81    Avg QP:17.80  size: 13636
[libx264 @ 0x7ff3c8888000] frame B:225   Avg QP:21.47  size:  3330
[libx264 @ 0x7ff3c8888000] consecutive B-frames:  1.6%  2.6%  1.0% 94.8%
[libx264 @ 0x7ff3c8888000] mb I  I16..4: 82.0%  0.0% 18.0%
[libx264 @ 0x7ff3c8888000] mb P  I16..4:  5.7%  0.0%  1.0%  P16..4: 13.6%  4.3%  1.8%  0.0%  0.0%    skip:73.6%
[libx264 @ 0x7ff3c8888000] mb B  I16..4:  0.5%  0.0%  0.0%  B16..8:  9.5%  1.2%  0.1%  direct: 1.7%  skip:87.0%  L0:43.7% L1:52.7% BI: 3.5%
[libx264 @ 0x7ff3c8888000] coded y,uvDC,uvAC intra: 11.8% 49.2% 2.0% inter: 1.9% 5.8% 0.0%
[libx264 @ 0x7ff3c8888000] i16 v,h,dc,p: 69% 15%  9%  7%
[libx264 @ 0x7ff3c8888000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 17% 19%  4%  5%  7%  4%  5%  3%
[libx264 @ 0x7ff3c8888000] i8c dc,h,v,p: 58% 15% 26%  2%
[libx264 @ 0x7ff3c8888000] Weighted P-Frames: Y:28.4% UV:0.0%
[libx264 @ 0x7ff3c8888000] ref P L0: 63.4% 15.3% 15.7%  5.0%  0.6%
[libx264 @ 0x7ff3c8888000] ref B L0: 90.5%  7.7%  1.8%
[libx264 @ 0x7ff3c8888000] ref B L1: 96.2%  3.8%
[libx264 @ 0x7ff3c8888000] kb/s:1517.33
[aac @ 0x7ff3c8889800] Qavg: 5013.114

    


    


    



  • How to get the output resolution after successful encode ?

    11 janvier 2021, par Daniel Birowsky Popeski

    I'm using fluent-ffmpeg and I'm already able to get the output resolution in the 'on end' event :

    


    createFfmpegCommand()
  .input(fs.createReadStream(readPath))
  .noAudio()
  .fps(30)
  .format('mp4')
  .videoCodec('libx264')
  .videoFilter([
   {filter: 'scale', options: '1920:1920:force_original_aspect_ratio=decrease'},
   {filter: 'setpts', options: '1.5*PTS'},
  ])
  .outputOption('-crf 30')
  .outputOption('-movflags frag_keyframe')
  .outputOption('-movflags +faststart')
  .output(mp4WriteStream)
  .on('start', () => console.log('processing started'))
  .on('error', err => console.error('err', err))
  .on('end', (_,res) => console.log('processing success',res))
  .run();


    


    However, i'd like it to be machine-readable (json or xml). Instead, it looks like this :

    


     ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.28)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2020-05-28T09:51:18.000000Z
  Duration: 00:00:02.23, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 9108 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2020-05-28T09:51:18.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
[libx264 @ 0x7f92d9808e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f92d9808e00] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x7f92d9808e00] 264 - core 161 r3027 4121277 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'pipe:1':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    encoder         : Lavf58.45.100
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2020-05-28T09:51:18.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=   64 fps=0.0 q=36.0 size=       0kB time=00:00:00.16 bitrate=   1.7kbits/s dup=21 drop=0 speed=0.316x    
frame=  100 fps=0.0 q=-1.0 Lsize=     108kB time=00:00:03.23 bitrate= 274.7kbits/s dup=33 drop=0 speed=3.25x    
video:106kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.906519%
[libx264 @ 0x7f92d9808e00] frame I:1     Avg QP:25.71  size:  8782
[libx264 @ 0x7f92d9808e00] frame P:25    Avg QP:30.10  size:  2308
[libx264 @ 0x7f92d9808e00] frame B:74    Avg QP:27.92  size:   564
[libx264 @ 0x7f92d9808e00] consecutive B-frames:  1.0%  0.0%  3.0% 96.0%
[libx264 @ 0x7f92d9808e00] mb I  I16..4: 19.4% 77.2%  3.3%
[libx264 @ 0x7f92d9808e00] mb P  I16..4:  0.3%  0.8%  0.1%  P16..4:  4.6%  1.3%  0.4%  0.0%  0.0%    skip:92.5%
[libx264 @ 0x7f92d9808e00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  4.0%  0.2%  0.0%  direct: 0.0%  skip:95.7%  L0:44.2% L1:54.8% BI: 1.0%
[libx264 @ 0x7f92d9808e00] 8x8 transform intra:75.0% inter:78.3%
[libx264 @ 0x7f92d9808e00] coded y,uvDC,uvAC intra: 8.8% 8.8% 2.4% inter: 0.3% 0.2% 0.0%
[libx264 @ 0x7f92d9808e00] i16 v,h,dc,p: 77%  7% 10%  6%
[libx264 @ 0x7f92d9808e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 48%  3% 42%  1%  1%  1%  1%  1%  1%
[libx264 @ 0x7f92d9808e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 16% 26%  7%  4%  4%  3%  5%  6%
[libx264 @ 0x7f92d9808e00] i8c dc,h,v,p: 89%  5%  5%  1%
[libx264 @ 0x7f92d9808e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f92d9808e00] ref P L0: 66.9% 11.1% 16.7%  5.3%
[libx264 @ 0x7f92d9808e00] ref B L0: 87.5%  9.9%  2.6%
[libx264 @ 0x7f92d9808e00] ref B L1: 96.4%  3.6%
[libx264 @ 0x7f92d9808e00] kb/s:259.80


    


    Which doesn't let me be comfortable that my regex to extract the output resolution is always going to work.

    


    Also, I don't wanna make another call/fileread just to get the resolution. Mainly because my files are stored in S3, where ffprobe doesn't work.