Recherche avancée

Médias (91)

Autres articles (101)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (11759)

  • Is there a way to use the ffmpeg binary/unix executable in a py2app application to run ffmpeg on computers without it installed ?

    4 mars 2021, par Human

    I wrote a small python script that is essentially just a text to speech script. It uses the pydub - audiosegment python library to convert the mp3 from gTTS to an ogg that can be played in pygame. A link to my github repository can be found here : https://github.com/AnupPlays/TTS

    


    this is the main function :

    


    def webscrape():
    global x
    global b
    b.state(['disabled'])
    src = "sound.mp3"
    dst = "sound.ogg"
    murl = str(url.get())
    response = requests.get(murl)
    response.raise_for_status()

    parse = bs4.BeautifulSoup(response.text, 'html.parser')
    x = str(parse.get_text())
    print(x)
    text = gTTS(x)
    text.save("sound.mp3")
    AudioSegment.from_mp3(src).export(dst, format='ogg')
    b.state(['!disabled'])


    


    this is a list of my imports :

    


    #Imports
import os
import sys
import pygame

#google text to speech
from gtts import gTTS

#requests and BeautifulSoup
import requests
import bs4

#pygame audio player
from pygame import mixer

#tkinter ui
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from tkinter import messagebox

#mp3 -> wav
from os import path
from pydub import AudioSegment


    


  • Run FFmpeg executable binary in Android

    4 septembre 2014, par Diego Stiehl

    I have an ffmpeg executable file compiled for ARM Android in my /data/data/APP/files folder, with execute permission.
    I am trying to execute a command based on an example extracted from the FFmpeg site.

    This is the command-line I’m typing :

    ./ffmpeg -loop 1 -i /mnt/sdcard/com.example.test/image.png -c:v libx264 -t 30 -pix_fmt yuv420p /mnt/sdcard/com.example.test/video.mp4

    My objetive is to execute it from my app, but even in command-line, I’m getting this error :

    ./ffmpeg: 1: Syntax error: "(" unexpected

    Does anyone know what is and how to solve it ?

    - UPDATE

    I found a newer version and I think I passed through that error.

    But now, for any call to ffmpeg executable, I’m getting an error like this :

    # ./ffmpeg -loop 1 -i /mnt/sdcard/com.example.teste/imagem.png -c:v libx264 -t 30 -pix_fmt yuv420p /mnt/sdcard/com.example.teste/video.mp4
    [1] + Stopped (signal)        ./ffmpeg -loop 1 -i /mnt/sdcard/com.example.teste/imagem.png -c:v libx264 -t 30 -pix_fmt yuv420p /mnt/sdcard/com.example.teste/video.mp4
    [1]   Segmentation fault      ./ffmpeg -loop 1 -i /mnt/sdcard/com.example.teste/imagem.png -c:v libx264 -t 30 -pix_fmt yuv420p /mnt/sdcard/com.example.teste/video.mp4

    What does it mean ?

  • How to grab ffmpeg's output as binary and write it to a file on the fly such that video players can play it in real time ?

    29 décembre 2022, par Mister Mystère

    I want to stream a RTSP-streaming device to a video player such as VLC but the catch is that, in between, the binary data needs to go through a custom high-speed serial link. I control what goes in this link from a C++ program.

    


    I was happily surprised to see that the following line allowed me to watch the RTSP stream by just opening "out.bin" from VLC which was a good lead for fast and efficient binary transmission of the stream :

    


    ffmpeg -i "rtsp://admin:password@X.X.X.X:554/h264Preview_01_main" -c:v copy -c:a copy -f mpegts out.bin


    


    I already wondered how ffmpeg manages to allow VLC to read that file, while itself writing to it at the same time. Turns out I was right to wonder, see below.

    


    I told myself I could make this command pipe its output to the standard output, and then in turn pipe the standard output to a file that I can read, (later, slice it, transmit the chunks and reconstruct it) and then write to an output file. However, this does not work :

    


    #include 
#include 
#include 

#define BUFSIZE 188 //MPEG-TS packet size

int main()
{
    char *cmd = (char*)"ffmpeg -i \"rtsp://admin:password@X.X.X.X:554/h264Preview_01_main\" -c:v copy -c:a copy -f mpegts pipe:1 -loglevel quiet";
    char buf[BUFSIZE];
    FILE *ptr, *file;

    file = fopen("./out.bin", "w");

    if (!file)
    {
        printf("Failed to open output file for writing, aborting");
       abort();
    }

    if ((ptr = popen(cmd, "r")) != NULL) {
       printf("Writing RTSP stream to file...");

       while (!kbhit())
       {
            if(fread(&buf, sizeof(char), BUFSIZE, ptr) != 0)
            {
               fwrite(buf, sizeof(char), BUFSIZE, file);
            }
            else
            {
                printf("No data\n");
            }
       }
       pclose(ptr);
    }
    else
    {
        printf("Failed to open pipe from ffmpeg command, aborting");
    }

    printf("End of program");

    fclose(file);
    return 0;
}


    


    Since VLC says "your input can't be opened" - whereas this works just fine :

    


    ffmpeg -i "rtsp://admin:password@X.X.X.X:554/h264Preview_01_main" -c:v copy -c:a copy -f mpegts pipe:1 -loglevel quiet > out.bin


    


    This is what ends up in the file after I close the program, versus the result of the command immediately above :
enter image description here

    


    The file is always 2kB regardless of how long I run the program : "No data" is shown repeatedly in the console output.

    


    Why doesn't it work ? If it is not just a bug, how can I grab the stream as binary at some point, and write it at the end to a file that VLC can read ?

    


    Update

    


    New code after applying Craig Estey's fix to my stupid mistake. The end result is that the MPEG-TS frames don't seem to shift anymore but the file writing stops partway into one of the first few frames (the console only shows a few ">" symbols and then stays silent, c.f. code).

    


    #include 
#include 
#include 

#define BUFSIZE 188                     // MPEG-TS packet size

int
main()
{
    char *cmd = (char *) "ffmpeg -i \"rtsp://127.0.0.1:8554/test.sdp\" -c:v copy -c:a copy -f mpegts pipe:1 -loglevel quiet";
    char buf[BUFSIZE];
    FILE *ptr,
    *file;

    file = fopen("./out.ts", "w");

    if (!file) {
        printf("Failed to open output file for writing, aborting");
        abort();
    }

    if ((ptr = popen(cmd, "r")) != NULL) {
        printf("Writing RTSP stream to file...");

        while(!kbhit()) {
            ssize_t rlen = fread(&buf, sizeof(char), BUFSIZE, ptr);
            if(rlen != 0)
            {
                printf(">");
                fwrite(buf, sizeof(char), rlen, file);
                fflush(file);
            }
        }
        pclose(ptr);
    }
    else {
        printf("Failed to open pipe from ffmpeg command, aborting");
    }

    printf("End of program");

    fclose(file);
    return 0;
}


    


    This can be tested on any computer with VLC and a webcam : open VLC, open capture device, capture mode directshow, (switch "play" for "stream"), next, display locally, select RTSP, Add, path=/test.sdp, next, transcoding=H264+MP3 (TS), replace rtsp ://:8554/ with rtsp ://127.0.0.1:8554/ in the generated command line, stream.

    


    To test that streaming is ok, you can just open a command terminal and enter "ffmpeg -i "rtsp ://127.0.0.1:8554/test.sdp" -c:v copy -c:a copy -f mpegts pipe:1 -loglevel quiet", the terminal should fill up with binary data.

    


    To test the program, just compile, run, and open out.ts after the program has run.