Recherche avancée

Médias (33)

Mot : - Tags -/creative commons

Autres articles (111)

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

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

  • Que fait exactement ce script ?

    18 janvier 2011, par

    Ce script est écrit en bash. Il est donc facilement utilisable sur n’importe quel serveur.
    Il n’est compatible qu’avec une liste de distributions précises (voir Liste des distributions compatibles).
    Installation de dépendances de MediaSPIP
    Son rôle principal est d’installer l’ensemble des dépendances logicielles nécessaires coté serveur à savoir :
    Les outils de base pour pouvoir installer le reste des dépendances Les outils de développements : build-essential (via APT depuis les dépôts officiels) ; (...)

Sur d’autres sites (9768)

  • sws_scale YUV —> RGB distorted image [closed]

    18 décembre 2024, par Sami susu

    I want to convert YUV420P image (received from H.264 stream) to RGB, while also resizing it, using sws_scale.
    
The size of the original image is 480 × 800. Just converting with same dimensions works fine.
    
But when I try to change the dimensions, I get a distorted image, with the following pattern :

    



      

    • changing to 481 × 800 will yield a distorted B&W image which looks like it's cut in the middle
    • 


    • 482 × 800 will be even more distorted
    • 


    • 483 × 800 is distorted but in color
    • 


    • 484 × 800 is ok (scaled correctly).
    • 


    



    Now this pattern follows - scaling will only work fine if the difference between divides by 4.

    



    Here's a sample code of the way that I decode and convert the image. All methods show "success".

    



    int srcX = 480;
int srcY = 800;
int dstX = 481; // or 482, 483 etc
int dstY = 800;

AVFrame* avFrameYUV = avcodec_alloc_frame();
avpicture_fill((AVPicture *)avFrameYUV, decoded_yuv_frame, PIX_FMT_YUV420P, srcX , srcY);

AVFrame *avFrameRGB = avcodec_alloc_frame();

AVPacket avPacket;
av_init_packet(&avPacket);
avPacket.size = read; // size of raw data
avPacket.data = raw_data; // raw data before decoding to YUV

int frame_decoded = 0;
int decoded_length = avcodec_decode_video2(g_avCodecContext, avFrameYUV, &frame_decoded, &avPacket);
int size = dstX * dstY * 3;

struct SwsContext *img_convert_ctx = sws_getContext(srcX, srcY, SOURCE_FORMAT, dstX, dstY, PIX_FMT_BGR24, SWS_BICUBIC, NULL, NULL, NULL);

avpicture_fill((AVPicture *)avFrameRGB, rgb_frame, PIX_FMT_RGB24, dstX, dstY);
sws_scale(img_convert_ctx, avFrameYUV->data, avFrameYUV->linesize, 0, srcY, avFrameRGB->data, avFrameRGB->linesize);

// draws the resulting frame with windows BitBlt
DrawBitmap(hdc, dstX, dstY, rgb_frame, size);

sws_freeContext(img_convert_ctx); 


    


  • Extend plain background in a video

    3 juillet 2022, par Maiki

    Is there any easier way to achieve this ?, I'd like to make a .bat file that modify 148 videos that are 3840x2160

    


    They belong to the COLORFUL platform video set 1.8.0

    


    Every video has a system or console in the middle of it and it has a plain color as background. I want to keep the resolution, 3840x2160 but I need to displace the image a 15% to the right so it will be neccesary to fill the left area with the same color it's being use as color of the background.

    


    This is a snapshot from one of these videos :

    


    Snapshot of the original video

    


    The result should be something like this :

    


    Snapshot of the video I'd like to get

    


    So far I was trying lot of things with no success, I maybe did it harder than it is really. I did a first script that crop the video :

    


    for %%X in (*.mp4) do .\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -filter:v "crop=2688:ih" -c:a copy -threads 4 "second_script\%%X"


    


    The new video will be stored in the second_script folder, then there is a second script that will use ffmpeg to export a picture from the video and magick.exe will help me to identify the color, after that it will use ffmpeg again to add an are of that color, but ... for some reason I don't know the color result is not the same

    


    for %%X in (*.mp4) do (
..\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -vf "select=eq(n\,100)" -vframes 1 %%~nX.png

magick.exe .\%%~nX.png -format "%%[hex:u.p{0,0}]" info: > temp.txt

for /f "delims=" %%i in (temp.txt) do (
..\ffmpeg\bin\ffmpeg.exe -threads 4 -i "%%X" -filter_complex "[0]pad = w=3840 : h=ih: x=3840-2688 : y=0 : color=#%%i" -movflags +faststart  -c:a copy -threads 4 "final\%%X"
)

)


    


    What I get is something like this :

    


    Final result, it doesn't look like I expected

    


    Would there be any easy way to do this ? any recommendation is really appreciate

    


  • invalid dropping st:0 and Non-monotonous DTS in output stream 0:1 errors in ffmpeg

    21 février 2020, par AlexZheda

    I would really be thankful if I could get help with the following.

    ffmpeg -f concat -safe 0 -i mylist.txt  
          -filter_complex "[0:v]setpts=.5*PTS[v1];
          [0:a]atempo=2,asetpts=N/SR/TB[a1]"
          -c:v h264_nvenc -map "[v1]" -map "[a1]"  x2_merged_vid.mp4

    But I get 2 errors and the resulting video is broken with the sound disappearing around the middle of the video.
    One type of the errors (there are loads of those) is this :

    [mp4 @ 0000019d21d66040] Non-monotonous DTS in output stream 0:1; previous: 28555274, current: 11264; changing to 28555275. This may result in incorrect timestamps in the output file.

    The other type of errors is like so :

    DTS 41437099, next:291253341916 st:0 invalid dropping
    PTS 41437099, next:291253341916 invalid dropping st:0

    The full log file is here.
    I am stumbled since I enforced asetpts=N/SR/TB, but the DTS and PTS are still not working properly..
    What else can I do to make it output a correct file ? I am not constrained in resources and can re-encode the whole thing frame by frame, but I cannot find how to do it.

    EDIT : It still does not work even with the approach of using concat filter. Same DTS/PTS errors.

       -filter_complex "[0:v:0][1:v:0]...[299:v:0]concat=n=300:v=1:a=0,fps=fps=30[cv1];
                            [0:a:0][1:a:0]...[299:a:0]concat=n=300:v=0:a=1,asetpts=N/SR/TB[ca1];
                      [cv1]setpts=0.25*PTS[v4];
                      [ca1]atempo=4,asetpts=N/SR/TB[a4]"
       -c:v h264_nvenc  -map "[v4]" -map "[a4]"  result.mp4

    I have uploaded the logs outputs from the ffmpeg and ffprobe in [(filepath,json),(filepath,json),...] [here]2.
    I have been scratching my head why those PTS can’t be synced. Via ffprobe all v:0 and a:0 streams start from 0. I checked their stream0 and stream1 durations also and they also match. I also have a feeling that not all of the video files get concatenated in the resulting video. Maybe the issue is with the h264_nvenc ?