Recherche avancée

Médias (91)

Autres articles (37)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

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

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (5477)

  • RGB to YUV422 conversion with ffmpeg, incorrect colors

    22 janvier 2016, par user3578571

    I’m trying to convert an 8bit RGB uncompressed to an mpeg2 mxf file (xdcam 422 HD 1080 50i) which is YUV422. With info from the FFMpeg docs and various websites i made the following command :

    ./ffmpeg -y -i test_lines.mov  -pix_fmt yuv422p -vcodec mpeg2video -non_linear_quant 1 -flags +ildct+ilme -top 1 -dc 10 -intra_vlc 1 -qmax 2 -vtag xd5c -rc_max_vbv_use 1 -rc_min_vbv_use 1 -g 12 -b:v 50000k -minrate 50000k -maxrate 50000k -bufsize 8000k -acodec pcm_s24le -ar 48000 -bf 2 -ac 2 lines_HD.mxf

    This gave me a result with the colors much brighter than the original.

    So i tried adding the options -color_range 1 -colorspace 1 -color_primaries 1 -color_trc 1 but this didn’t seem to do anything.

    After adding colormatrix=bt601:bt709 i got a way better image, but slightly darker than the original and it also feels weird specifying this option cause the source is also in the REC709 colorspace, so why specify it differently ?

    Next i regenerated my source image to an YUV codec (prores) and rerun FFMpeg on it with the colors coming out just fine. Therefore i think it has to be an RGB -> YUV problem.
    Does somebody have an idea how to this properly ? I can provide screenshots of the different results on a videoscope as soon as i’m back at the office, if anybody is interested.

    Last, i know there are various topics touching this subject but either they go way over my head FFmpeg wise or bring me to the stage where i already am.

  • Creating TS file from MP4 file - Differing durations

    2 mai 2018, par Mark Walsh

    I am running the following command to crop an MP4 file

    -i "C:\FFMPEG\Temp\S3\2ad239d1-f4b9-4854-afe4-7e28157893daHighRes.mp4" -q:v 0 -y -ss 00:00:01.000 -to 00:00:29.834 -vf "fade=t=out:st=29.334:d=0.500, scale=iw*min(1080/iw\,720/ih):ih*min(1080/iw\,720/ih),pad=1080:720:(1080-iw)/2:(720-ih)/2" "C:\FFMPEG\Temp\Crops\5ae9806e32ab040978d97013_0.ts"

    As you can see I want to crop a video of exactly 28834 milliseconds long. However the created file when inspecting it via ffprobe is 28873 milliseconds long. Why is this ?

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