Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (27)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (3175)

  • Win Batch : Not getting data from array that works just a line above it

    5 mai 2018, par HASJ

    This code is from a CLI batch video converter that I’m trying to make using FFmpeg.

    ::@echo off
    setlocal enableDelayedExpansion
    ::Create variable so that the CMD can understand "NL" as a New Line
    ::Both spaces are needed
    set NL=^


    :choice
    echo [1] Single input!NL![2] Single input with multiple resolutions!NL![3] Multiple inputs!NL![4] Multiple inputs with multiple resolutions!NL![5] Exit
    set /p choice="Choose: "
    if /I %choice% EQU 1 goto :setSingleInput
    if /I %choice% EQU 2 goto :setSingleInput
    ::Please already have your files in the Clipboard before choosing options [3] or [4]
    if /I %choice% EQU 3 goto :getFileList
    if /I %choice% EQU 4 goto :getFileList
    if /I %choice% EQU 5 goto :EOL

    :setSingleInput
    set /p input="Input: "
    mediainfo --Output=Video;"%%Height%%" %input%> %temp%\ffmpegres.txt
    set /p height=< %temp%\ffmpegres.txt
    ::del %temp%\ffmpegres.txt
    if /I %choice% EQU 1 goto :inputSingle
    if /I %choice% EQU 2 goto :inputMultiple

    :inputSingle
    if /I %height% GTR 720 goto :1080
    if /I %height% GTR 480 if /I %height% LEQ 720 goto :720
    if /I %height% LSS 481 goto :480

    :inputMultiple
    if /I %height% GTR 720 goto :1080m
    if /I %height% GTR 480 if /I %height% LEQ 720 goto :720m
    if /I %height% LEQ 481 goto :480m

    :getFileList
    Powershell Get-Clipboard > %temp%\ffmpeglist.txt
    ::Thanks to MichaelS for the following code https://stackoverflow.com/a/32717316/5833369
    set fileList=%temp%\ffmpeglist.txt
    set x=1
    if /I %choice% EQU 3 goto :inputVarious
    if /I %choice% EQU 4 goto :inputVariousMultiple

    :inputVarious
    for /F "delims=|" %%l in (%fileList%) do (
    set input[%x%]=%%l
    mediainfo --Output=Video;%%Height%% !%input[%x%]%! > %temp%\ffmpegres%x%.txt
    set %height[1]%=< %temp%\ffmpegres%x%.txt
    set /a x=%x%+1
    )
    set x=1
    echo %height[1]%
    goto :EOL
    ::if /I !height[%x%]! GTR 720 goto :1080v
    ::if /I !height[%x%]! GTR 480 if /I !height! LEQ 720 goto :720v
    ::if /I !height[%x%]! LSS 481 goto :480v

    :inputVariousMultiple
    if /I !height! GTR 720 goto :1080vm
    if /I !height! GTR 480 if /I !height! LEQ 720 goto :720vm
    if /I !height! LSS 481 goto :480vm

    :1080
    echo Encoding %input% @ %height%p to x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 3000k -crf 23 %input%.%height%p.mkv
    goto :choice

    :720
    echo Encoding %input% @ %height%p to x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 2000k -crf 22 %input%.%height%p.mkv
    goto :choice

    :480
    echo Encoding %input% @ %height%p to x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 %input%.%height%p.mkv
    goto :choice

    :1080m
    echo Encoding %input% to 1080p x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 3000k -crf 23 %input%.1080p.mkv
    echo Encoding %input% to 720p x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -vf scale=-1:720 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 2000k -crf 21 %input%.720p.mkv
    echo Encoding %input% to 480p x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -vf scale=-2:480 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 %input%.480p.mkv
    goto :choice

    :720m
    echo Encoding %input% to 720p and 480p x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 2000k -crf 21 %input%.720p.mkv
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -vf scale=-2:480 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 %input%.480p.mkv
    goto :choice

    :480m
    echo Encoding %input% to 480p and 360p x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 %input%.480p.mkv
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i %input% -c:v libx265 -vf scale=-1:360 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 600k -crf 17 %input%.360p.mkv
    goto :choice

    :1080v
    echo Encoding !input[%x%]! @ !height[%x%]!p to x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 3000k -crf 23 !input[%x%]!.!height!p.mkv
    set /a x=%x%+1
    )
    del %temp%\ffmpeg*.txt
    goto :choice

    :720v
    for /F "delims=|" %%l in (%fileList%) do (
    set input[%x%]=%%l
    mediainfo --Output=Video;"%%Height%%" !input[%x%]!> %temp%\ffmpegres%x%.txt
    set height[%x%]=< %temp%\ffmpegres%x%.txt
    echo Encoding !input[%x%]! @ !height[%x%]!p to x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 2000k -crf 21 !input[%x%]!.!height!p.mkv
    set /a x=!x!+1
    )
    del %temp%\ffmpeg*.txt
    goto :choice

    :480v
    for /F "delims=|" %%l in (%fileList%) do (
    set input[%x%]=%%l
    mediainfo --Output=Video;"%%Height%%" !input[%x%]!> %temp%\ffmpegres%x%.txt
    set height[%x%]=< %temp%\ffmpegres%x%.txt
    echo Encoding !input[%x%]! @ !height[%x%]!p to x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 !input[%x%]!.!height!p.mkv
    set /a x=!x!+1
    )
    del %temp%\ffmpeg*.txt
    goto :choice

    :1080vm
    for /F "delims=|" %%l in (%fileList%) do (
    set input[%x%]=%%l
    mediainfo --Output=Video;"%%Height%%" !input[%x%]!> %temp%\ffmpegres%x%.txt
    set height[%x%]=< %temp%\ffmpegres%x%.txt
    echo Encoding !input[%x%]! to 1080p, 720p and 480p with x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 3000k -crf 23 !input[%x%]!.1080p.mkv
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -vf scale=-1:720 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 2000k -crf 21 !input[%x%]!.720p.mkv
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -vf scale=-2:480 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 !input[%x%]!.480p.mkv
    set /a x=!x!+1
    )
    ::del %temp%\ffmpeg*.txt
    goto :choice

    :720vm
    for /F "delims=|" %%l in (%fileList%) do (
    set input[%x%]=%%l
    mediainfo --Output=Video;"%%Height%%" !input[%x%]!> %temp%\ffmpegres%x%.txt
    set height[%x%]=< %temp%\ffmpegres%x%.txt
    echo Encoding !input[%x%]! to 720p and 480p with x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 2000k -crf 21 !input[%x%]!.720p.mkv
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -vf scale=-2:480 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 !input[%x%]!.480p.mkv
    set /a x=!x!+1
    )
    ::del %temp%\ffmpeg*.txt
    goto :choice

    :480vm
    for /F "delims=|" %%l in (%fileList%) do (
    set input[%x%]=%%l
    mediainfo --Output=Video;"%%Height%%" !input[%x%]!> %temp%\ffmpegres%x%.txt
    set height[%x%]=< %temp%\ffmpegres%x%.txt
    echo Encoding !input[%x%]! to 480p and 360p with x265
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 1000k -crf 19 !input[%x%]!.480p.mkv
    ffmpeg -y -hide_banner -hwaccel cuvid -loglevel error -i !input[%x%]! -c:v libx265 -vf scale=-1:360 -x265-params log-level=error -t 15 -c:a copy -preset ultrafast -b:v 600k -crf 17 !input[%x%]!.360p.mkv
    set /a x=!x!+1
    )
    ::del %temp%\ffmpeg*.txt
    goto :choice

    :EOL
    ::endlocal
    pause

    Everything works until it gets to !%input[%x%]%! in the :inputVarious group.

    Because this is the output I get from that line :

    mediainfo --Output=Video;%Height% !x!  1>\Temp\ffmpegres1.txt

    What I’m trying to do is get the data stored in the input[x] array position and send it to mediainfo as input, so that it can get the video’s resolution, store that into the height[x] array.

    I have no idea what I’m doing wrong. Could someone help me ? Tips on how to make the code less redundant and more elegant are also appreciated.

    Obs. : I tried to recreate this in Python but I’m too much of a bad study and couldn’t get working (although what I was able to do, was done in a less janky way)

  • Support scaling to UHD

    6 mai 2018, par Aurelius Schnitzler

    I am using ffmpeg with

    ffmpeg -i GOPR1373.MP4 -c:v libx264 -vf "pad=width=5848:height=2924:x=1964:y=922:color=black,scale=3840:2160" GOPR1373_w.MP4

    Which yields to Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height and x264 [error]: malloc of size 43688832 failed

    yet

    ffmpeg -i GOPR1373.MP4 -c:v libx264 -vf "pad=width=5848:height=2924:x=1964:y=922:color=black,scale=1920:1080" GOPR1373_w.MP4

    works.

    How to fix this ?

    EDIT : I solved it by freeing up memory.

  • mpeg2 ts android ffmpeg openmax

    10 octobre 2014, par WLGfx

    The setup is as follows :

    1. Multicast server 1000Mbs, UDP, Mpeg2-TS Part 1 (H.222) streaming live TV-channels.
    2. Quad core 1.5Ghz Android 4.2.2 GLES 2.0 renderer.
    3. FFMpeg library.
    4. Eclipse Kepler, Android SDK/NDK, etc. Running on Windows 8.1.
    5. Output screen 1920 x 1080, I am using a texture of 2048 x 1024 and getting between 35 and 45 Frames per second.

    The app :

    1. Renderer thread runs continuously and updates a single texture by uploading segments to the gpu when media images are ready.
    2. Media handler thread, downloads and processes media from server/or local storage.
    3. Video thread(s), one for buffering the UDP packets and another for decoding the packets into frames.

    I am connecting ffmpeg to the UDP stream just fine and the packets are being buffered and seemingly decoded fine. The packet buffers are plenty, no under/over-flows. The problem I am facing is it appears to be chopping up frames (ie only playing back 1 out of every so many frames). I understand that I need to distinguish I/P/B frames, but at the moment, hands up, I ain’t got a clue. I’ve even tried a hack to detect I frames to no avail. Plus, I am only rendering the frames to less than a quarter of the screen. So I’m not using full screen decoding.

    The decoded frames are also stored in separate buffers to cut out page tearing. The number of buffers I’ve changed too, from 1 to 10 with no luck.

    From what I’ve found about OpenMax IL, is it only handles MPeg2-TS Part 3 (H.264 and AAC), but you can use your own decoder. I understand that you can add your own decode component to it. Would it be worth me trying this route or should I continue on with ffmpeg ?

    The frame decoder (only the renderer will convert and scale the frames when ready)
    /*
    * This function will run through the packets and keep decoding
    * until a frame is ready first, or out of packets
    */

    while (packetsUsed[decCurrent])
    {
       hack_for_i_frame:
       i = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packets[decCurrent]);
       packetsUsed[decCurrent] = 0; // finished with this one
       i = packets[decCurrent].flags & 0x0001;
       decCurrent++;
       if (decCurrent >= MAXPACKETS) decCurrent = 0;
       if (frameFinished)
       {
           ready_pFrame = pFrame;
           frameReady = true;  // notify renderer
           frameCounter++;
           if (frameCounter>=MAXFRAMES) frameCounter = 0;
           pFrame = pFrames[frameCounter];
           return 0;
       }
       else if (i)
           goto hack_for_i_frame;
    }

    return 0;

    The packet reader (spawned as a pthread)
    void *mainPacketReader(void *voidptr)

    int res ;

    while ( threadState == TS_RUNNING )
    {
       if (packetsUsed[prCurrent])
       {
           LOGE("Packet buffer overflow, dropping packet...");
           av_read_frame( pFormatCtx, &packet );
       }
       else if ( av_read_frame( pFormatCtx, &packets[prCurrent] ) >= 0 )
       {
           if ( packets[prCurrent].stream_index == videoStream )
           {
               packetsUsed[prCurrent] = 1; // flag as used
               prCurrent++;
               if ( prCurrent >= MAXPACKETS )
               {
                   prCurrent = 0;
               }
           }

           // here check if the packet is audio and add to audio buffer
       }
    }
    return NULL;

    And the renderer just simply does this
    // texture has already been bound before calling this function

    if ( frameReady == false ) return;

    AVFrame *temp;  // set to frame 'not' currently being decoded
    temp = ready_pFrame;

    sws_scale(sws_ctx,(uint8_t const* const *)temp->data,
           temp->linesize, 0, pCodecCtx->height,
           pFrameRGB->data, pFrameRGB->linesize);

    glTexSubImage2D(GL_TEXTURE_2D, 0,
           XPOS, YPOS, WID, HGT,
           GL_RGBA, GL_UNSIGNED_BYTE, buffer);

    frameReady = false;

    In the past, libvlc had audio syncing problems too, so that is my decision for going with ffmpeg and doing all the donkey work from scratch.

    If anybody has any pointers of how to stop the choppiness of the video playback (works great in VLC player) or possibly another route to go down, it would be seriously appreciated.

    EDIT I removed the hack for the I-frame (completely useless). Move the sws_scale function from the renderer to the packet decoder. And I left the udp packet reader thread alone.

    In the meantime I’ve also changed the packet reader thread and the packet decoder threads priority to real-time. Since doing that I don’t get shed loads of dropped packets.