Recherche avancée

Médias (91)

Autres articles (103)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • La gestion des forums

    3 novembre 2011, par

    Si les forums sont activés sur le site, les administrateurs ont la possibilité de les gérer depuis l’interface d’administration ou depuis l’article même dans le bloc de modification de l’article qui se trouve dans la navigation de la page.
    Accès à l’interface de modération des messages
    Lorsqu’il est identifié sur le site, l’administrateur peut procéder de deux manières pour gérer les forums.
    S’il souhaite modifier (modérer, déclarer comme SPAM un message) les forums d’un article particulier, il a à sa (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

Sur d’autres sites (9036)

  • How can I add a random watermark to a video during processing in Node.js and Express.js using FFmpeg ?

    3 avril 2023, par Ariful islam

    I want to add a watermark to a video that changes randomly during processing. I am using Node.js and Express.js with FFmpeg. Currently, I am able to add a static watermark to the video using the drawtext filter. However, I want to change the watermark text randomly every few seconds.

    


    How can I achieve this using FFmpeg in my Node.js and Express.js app ? Here's my current code :

    


    const email = 'name@gmail.com';
app.post('/addwatermark', upload.single('video'), (req, res) => {
const fileName = path.basename(req.file.path) + '.mp4';
const outputPath = `public/reduceSize/${fileName}`;
const outputPathWithWatermark = `public/reduceSize/${fileName}-wm.mp4`;
let watermarkPosition = { x: 10, y: 650 };

// Create the directory if it doesn't exist
const outputDir = path.dirname(outputPathWithWatermark);
if (!fs.existsSync(outputDir)) {
    fs.mkdirSync(outputDir, { recursive: true });
}

// Send a comment to keep the connection alive
res.write(': ping\n\n');

// Function to randomly generate watermark position
const changeWatermarkPosition = () => {
    watermarkPosition = { x: Math.floor(Math.random() * 100), y: Math.floor(Math.random() * 100) };
};

// Change watermark position every 5 seconds 
setInterval(changeWatermarkPosition, 5000);
const watermarkStyle = `-vf drawtext=text='${email}':x=(w-text_w-10):y=(h-text_h-10):fontcolor=white:fontsize=24:shadowcolor=black:shadowx=1:shadowy=1:box=1:y=${watermarkPosition.y}:fontcolor=red:fontsize=24:shadowcolor=black:shadowx=1:shadowy=1:box=1:boxcolor=black@0.5`

ffmpeg(req.file.path)
    .addOption(watermarkStyle)
    .output(outputPathWithWatermark)
    .videoCodec('libx264')
    .audioCodec('aac')
    .size('50%')
    .on('error', (err) => {
        console.error(`FFmpeg error: ${err.message}`);
        res.status(500).json({ message: err.message });
    })
    .on('progress', (progress) => {
        // Set the watermark position every 5 seconds randomly
        changeWatermarkPosition();

        const mb = progress.targetSize / 1024;
        const data = {
            message: `Processing: ${mb.toFixed(2)} MB converted`,
            watermark: `Adding watermark to video: ${progress.framesProcessed} frames processed`
        };
        console.log(data.message);
        res.write(`data: ${JSON.stringify(data)}\n\n`);

    })
    .on('end', () => {
        console.log(`Video successfully converted to ${outputPathWithWatermark}`);
        // Remove the temporary file
    })
    .run();
 });


    


    I want to secure my video from unauthorized person by using email in a video and the email will be move around the video randomly every 5 seconds.

    


    I have read this (Add dynamic watermark that randomly changes position over video React/Node) document but didn't get any solution.

    


  • OpenCV is able to read the stream but VLC not

    25 avril 2023, par Ahmet Çavdar

    I'm trying to stream my webcam frames to an UDP address. Here is my sender code.

    


    cmd = ['ffmpeg', '-y', '-f', 'rawvideo', '-pixel_format', 'bgr24', '-video_size', f'{width}x{height}', 
       '-i', '-', '-c:v', 'mpeg4','-preset', 'ultrafast', '-tune', 'zerolatency','-b:v', '1.5M',
       '-f', 'mpegts', f'udp://@{ip_address}:{port}']
p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
camera = cv2.VideoCapture(0)
while True:
    ret, frame = camera.read()
    cv2.imshow("Sender",frame)
    if not ret:
        break
    p.stdin.write(frame.tobytes())
    p.stdin.flush()
    if cv2.waitKey(1) & 0xFF == ord('q'):
            break


    


    This Python code can make stream successfully. I can read the stream with this receiver code.

    


    q = queue.Queue()
def receive():
    cap = cv2.VideoCapture('udp://@xxx.x.xxx.xxx:5000')
    ret, frame = cap.read()
    q.put(frame)
    while ret:
        ret, frame = cap.read()
        q.put(frame)
def display():
    while True:
        if q.empty() != True:
            frame = q.get()
            cv2.imshow('Receiver', frame)
        k = cv2.waitKey(1) & 0xff
        if k == 27:  # press 'ESC' to quit
            break
tr = threading.Thread(target=receive, daemon=True)
td = threading.Thread(target=display)
tr.start()
td.start()
td.join()


    


    But I can not watch the stream from VLC. I'm going to Media->Open Network Stream->
udp ://@xxx.x.xxx.xxx:5000 to watch stream. After some seconds, the timer that located bottom left of VLC starts to increase but there are no frames in screen, just VLC icon.

    


    I checked firewall rules, opened all ports to UDP connections. I am using my IP address to send frames and watch them.
Also, I tried other video codecs like h264, hvec, mpeg4, rawvideo.
Additionally, I tried to watch stream by using Windows Media Player but it didn't work.

    


    What should I do to fix this issue ?

    


  • Unable to get a frame using ffmpeg [closed]

    24 mars 2023, par Prakhar

    I have an SRT stream, which I am listening on an Ubuntu server. I want to be able to take a frame as a PNG at any given time, so that I can analyze that image. Given that it's a live stream, I should not be defining time of when do I want to download the frame, it should be instantaneous.

    


    I tried following but in vain

    


    ffmpeg -i 'srt://10.174.190.221:5000?streamid=ABCDE' %04d.png


    


    This just starts the streaming, and does not produce the PNG files. Output which I get on screen

    


        Last message repeated 1 times
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] no frame!
[h264 @ 0x7317c80] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] no frame!
[h264 @ 0x7317c80] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] no frame!
[h264 @ 0x7317c80] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] no frame!
[h264 @ 0x7317c80] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] no frame!
[h264 @ 0x7317c80] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] non-existing PPS 0 referenced
[h264 @ 0x7317c80] decode_slice_header error
[h264 @ 0x7317c80] no frame!

Input #0, mpegts, from 'srt://10.174.190.221:5000?streamid=ABCDE':
  Duration: N/A, start: 61221.726022, bitrate: N/A
  Program 1 
    Metadata:
      service_name    : ABCDE
      service_provider: VITEC
  Stream #0:0[0x4da]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn
  Stream #0:1[0x2d](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
Finishing stream 0:0 without any data written to it.
Output #0, image2, to '%04d.png':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: png, rgb24, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 59.94 fps, 59.94 tbn
    Metadata:
      encoder         : Lavc59.37.100 png
frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


    


    Would appreciate any help