Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (20)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (2903)

  • VideoJS for HLS streaming not working on iOS

    13 février 2024, par Aames

    I have a website where I stream audio using HLS (m3u8 playlist + ts files).
I use VideoJS 8.3.0 to handle the stream in the frontend side.
The streaming works in all devices (PC, Android, Mac) except in iOS where it works intermittently and often it blocks.

    


    Here is my videojs initialization :

    


    player = videojs('stream-id', {
            controls: false, autoplay: true, preload: 'auto',
            html5: {
               vhs: {overrideNative: false},
               nativeAudioTracks: true
           }
        });

...

player.src({ type: 'application/x-mpegURL', src: 'https://.../master.m3u8' });



    


    And these are the headers of the m3u8 file :

    


    #EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-PROGRAM-DATE-TIME:2024-02-13T09:00:00Z
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-DISCONTINUITY
#EXTINF:10.007800,
master0.ts
#EXTINF:7.214989,
master1.ts
....


    


    I use ffmpeg to create the playlist from mp3 files :

    


    ffmpeg -i inputFileName -c:a aac -b:a 128k -ac 2 -f hls -hls_time 10 -preset ultrafast -map 0:a -flags -global_header -hls_list_size 0 -hls_flags append_list outputFileName



    


    Am I doing something wrong ? Any help would be appreciated
Thanks

    


    I tried this solution : Videojs HLS m3u8 files are not playing in iOS devices and safari browser but it does not work for me

    


  • How to extract the first frame from a video ?

    10 août 2024, par Andrew

    I am trying to extract the first frame from a video to save it as a preview.

    


    Here's an almost working solution using ffmpeg :

    


    func extractFirstFrame(videoBytes []byte) ([]byte, error) {
    input := bytes.NewReader(videoBytes)

    var output bytes.Buffer

    err := ffmpeg.Input("pipe:0").
        Filter("select", ffmpeg.Args{"gte(n,1)"}).
        Output(
            "pipe:1",
            ffmpeg.KwArgs{
                "vframes": 1,
                "format":  "image2",
                "vcodec":  "mjpeg",
            }).
        WithInput(input).
        WithOutput(&output).
        Run()

    if err != nil {
        return nil, fmt.Errorf("error extracting frame: %v", err)
    }

    return output.Bytes(), nil
}


    


    The problem with this is that it can only process horizontal videos. For some reason it will throw a 0xbebbb1b7 error for a vertical videos. I don't understand why is that, probably because this is my very first time with ffmpeg.

    


    Also, I am concerned if this solution is optimal. My assumption is that the whole video will be loaded into the memory first, which is kinda bad and I would like to avoid that

    


    I use https://github.com/u2takey/ffmpeg-go, but errors are the same even if I run it using exec :

    


        cmd := exec.Command(
        "ffmpeg",
        "-i", "pipe:0",
        "-vf", "select=eq(n\\,0)",
        "-q:v", "3",
        "-f", "image2",
        "pipe:1",
    )


    


    Interestingly enough, I noticed that running command in the terminal will work as expected with any type of video ffmpeg -i .\video_2024-08-10_00-03-00.mp4 -vf "select=eq(n\,0)"  -q:v 3 output_image.jpg, so the problem may be on how I send those videos to my server. I useFiber and send videos as multipart/form-data and then read it like this :

    


        form_data, err := c.FormFile("image")
    file, err := form_data.Open()
    bytes, err := io.ReadAll(file)
    ....
    preview, err := extractFirstFrame(bytes)



    


    I also managed to find logs for the failed attempt :

    


    
ffmpeg version 7.0.2-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562ff0e80] stream 0, offset 0x30: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562ff0e80] Could not find codec parameters for stream 1 (Video: h264 (avc1 / 0x31637661), none, 720x1280, 3093 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2024-08-09T20:00:29.000000Z
  Duration: 00:00:06.80, start: 0.000000, bitrate: N/A
  Stream #0:0[0x1](eng): Audio: aac (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 74 kb/s (default)
      Metadata:
        creation_time   : 2024-08-09T20:00:23.000000Z
        handler_name    : SoundHandle
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Video: h264 (avc1 / 0x31637661), none, 720x1280, 3093 kb/s, 30 fps, 30 tbr, 90k tbn (default)
      Metadata:
        creation_time   : 2024-08-09T20:00:23.000000Z
        handler_name    : VideoHandle
        vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562ff0e80] stream 1, offset 0x5d: partial file
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562fda2c0] Error during demuxing: Invalid data found when processing input
Cannot determine format of input 0:1 after EOF
[vf#0:0 @ 000002a5636c0ec0] Task finished with error code: -1094995529 (Invalid data found when processing input)
[vf#0:0 @ 000002a5636c0ec0] Terminating thread with return code -1094995529 (Invalid data found when processing input)
[vost#0:0/mjpeg @ 000002a5636c0400] Could not open encoder before EOF
[vost#0:0/mjpeg @ 000002a5636c0400] Task finished with error code: -22 (Invalid argument)
[vost#0:0/mjpeg @ 000002a5636c0400] Terminating thread with return code -22 (Invalid argument)
[out#0/image2 @ 000002a562ff5640] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!


    


    Logs for the same video, but ran via terminal :

    


    ffmpeg version 7.0.2-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\video_2024-08-10_00-03-00.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2024-08-09T20:00:29.000000Z
  Duration: 00:00:06.80, start: 0.000000, bitrate: 3175 kb/s
  Stream #0:0[0x1](eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 74 kb/s (default)
      Metadata:
        creation_time   : 2024-08-09T20:00:23.000000Z
        handler_name    : SoundHandle
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 720x1280, 3093 kb/s, 30 fps, 30 tbr, 90k tbn (default)
      Metadata:
        creation_time   : 2024-08-09T20:00:23.000000Z
        handler_name    : VideoHandle
        vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 00000219eb4d0c00] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'output_image.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.1.100
  Stream #0:0(eng): Video: mjpeg, yuvj420p(pc, unknown/bt709/bt709, progressive), 720x1280, q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
      Metadata:
        creation_time   : 2024-08-09T20:00:23.000000Z
        handler_name    : VideoHandle
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.3.100 mjpeg
      Side data:
        cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[image2 @ 00000219e7aa51c0] The specified filename 'output_image.jpg' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 00000219e7aa51c0] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
[out#0/image2 @ 00000219e7b5e400] video:49KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=    1 fps=0.0 q=3.0 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.322x


    


    I also realized that the problem was not related to the video orientation, but to to the video from a specific source uploaded specifically on my server 🤡 Such a weird coincidence that I decided to test my video upload with those files, but anyway. And those are.... Downloaded instagram reels lol. But again, ffmpeg works just fine when ran in terminal

    


  • how to stop the FFmpeg process programmatically without using Ctrl + C ?

    30 septembre 2024, par bee
    const shell = require("shelljs");

const processShell = shell.exec(
  `ffmpeg -i "https://pull-hls-f16-va01.tiktokcdn.com/game/stream-2998228870023348312_or4/index.m3u8?expire=1728629296&session_id=000-2024092706481532076B1319E1100113F8&sign=1016b521d08053bc0ae8eddb0881b029" -movflags use_metadata_tags -map_metadata 0 -metadata title="Chill chill kiß║┐m k├¿o Warthunder" -metadata artist="bacgaucam" -metadata year="2024" -c copy "downloads/bacgaucam-927202491939.mp4" -n -stats -hide_banner -loglevel error`,
  { async: true }
);

setTimeout(() => {
  // processShell.kill();
  process.exit();
}, 20000);


    


    my video only works when I use Ctrl+C to stop it. I’ve tried using process.exit(), .kill(pid, "SIGINT"), and the .kill() method from the shell.exec() ffmpeg() of fluent-ffmpeg or spawn() of child_process reference, but none of them work

    


    If you want to test it directly, please message me to get a new live url in case it expires (https://t.me/ppnam15) or clone this :
https://github.com/loo-kuhs/tiktok-live-downloader

    


    can anyone help ? Thanks !