Recherche avancée

Médias (1)

Mot : - Tags -/ogv

Autres articles (58)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (9280)

  • How to convert multiple jpg images to MP4 format using FFmpeg ?

    30 janvier 2024, par PDLAOZEI
      

    • I first used the FFmpeg command line to implement this function.
ffmpeg -framerate 1 -pattern_type glob -i "./image/*.jpg" -c:v libx264 -crf 25 -vf format=yuv420p -movflags +faststart test.mp4

      


    • 


    • Then I use FFmpeg's api to convert multiple jpg into MP4 format, the process is probably.

      


    • 


    


      

    1. Find the AV_CODEC_ID_MPEG4 encoder.
    2. 


    3. Turn on the encoder.
    4. 


    5. Set video stream parameters.
    6. 


    7. Open the output file.
    8. 


    9. Write file header.
    10. 


    11. Allocate image frame rate and buffer.
    12. 


    13. Write each jpg image to the video (write in a loop).
7-1. read jpg image.
7-2. Find video stream information.
7-3. Decoded image frame.
7-4. Transcode to yuv420p.
7-5. Encode and write video frames.
    14. 


    15. Finally, free memory.
    16. 


    


    update the reproducible example

    


    #include <iostream>&#xA;#include <vector>&#xA;#include <string>&#xA;#include <chrono>&#xA;#include <thread>&#xA;&#xA;#include <filesystem>&#xA;#include <algorithm>&#xA;#include <iomanip>&#xA;#include <sys></sys>stat.h>&#xA;&#xA;extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;}&#xA;&#xA;namespace fs = std::filesystem;&#xA;&#xA;bool compareFilenames(const std::string &amp;str1, const std::string &amp;str2)&#xA;{&#xA;    //ToDo Sort&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    &#xA;    fs::path folderPath = "" //replace your image foldePath&#xA;&#xA;    std::vector imageFiles;&#xA;    for (const auto &amp;entry : fs::directory_iterator(folderPath))&#xA;    {&#xA;        if (entry.is_regular_file() &amp;&amp; entry.path().extension() == ".jpg")&#xA;        {&#xA;            imageFiles.push_back(entry.path());&#xA;        }&#xA;    }&#xA;&#xA;    std::sort(imageFiles.begin(), imageFiles.end(), compareFilenames);&#xA;&#xA;    std::string outputVideoFile = "output.mp4";&#xA;&#xA;    AVFormatContext *formatContext = nullptr;&#xA;    AVCodecContext *codecContext = nullptr;&#xA;    AVStream *videoStream = nullptr;&#xA;&#xA;    av_register_all();&#xA;    avformat_alloc_output_context2(&amp;formatContext, nullptr, nullptr, outputVideoFile.c_str());&#xA;&#xA;&#xA;    AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_MPEG4);//AV_CODEC_ID_H264&#xA;    videoStream = avformat_new_stream(formatContext, codec);&#xA;    codecContext = avcodec_alloc_context3(codec);&#xA;&#xA;    codecContext->codec_id = codec->id;&#xA;    codecContext->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    codecContext->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    codecContext->width = 1920;&#xA;    codecContext->height = 1080;&#xA;    codecContext->time_base = {1, 2}; &#xA;    codecContext->bit_rate = 100000000;&#xA;    codecContext->gop_size = 1;&#xA;&#xA;    avcodec_open2(codecContext, codec, nullptr);&#xA;    avcodec_parameters_from_context(videoStream->codecpar, codecContext);&#xA;&#xA;    avio_open(&amp;formatContext->pb, outputVideoFile.c_str(), AVIO_FLAG_WRITE);&#xA;    avformat_write_header(formatContext, NULL);&#xA;&#xA;    AVFrame *frame = av_frame_alloc();&#xA;&#xA;    std::vector imageBuffer(codecContext->width * codecContext->height * 3);&#xA;    AVPacket packet;&#xA;&#xA;    for (const std::string &amp;imageFile : imageFiles)&#xA;    {&#xA;&#xA;        AVFormatContext *inputFormatContext = avformat_alloc_context();&#xA;        avformat_open_input(&amp;inputFormatContext, imageFile.c_str(), nullptr, nullptr);&#xA;&#xA;        avformat_find_stream_info(inputFormatContext, nullptr);&#xA;&#xA;        AVCodec *inputCodec = nullptr;&#xA;        AVCodecContext *inputCodecContext = nullptr;&#xA;        int videoStreamIndex = -1;&#xA;&#xA;        for (unsigned int i = 0; i &lt; inputFormatContext->nb_streams; i&#x2B;&#x2B;)&#xA;        {&#xA;            if (inputFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;            {&#xA;                videoStreamIndex = i;&#xA;                inputCodec = avcodec_find_decoder(inputFormatContext->streams[i]->codecpar->codec_id);&#xA;                inputCodecContext = avcodec_alloc_context3(inputCodec);&#xA;                avcodec_parameters_to_context(inputCodecContext, inputFormatContext->streams[i]->codecpar);&#xA;                avcodec_open2(inputCodecContext, inputCodec, NULL);&#xA;                break;&#xA;            }&#xA;        }&#xA;&#xA;        AVFrame *inputFrame = av_frame_alloc();&#xA;        while (av_read_frame(inputFormatContext, &amp;packet) >= 0)&#xA;        {&#xA;            if (packet.stream_index == videoStreamIndex)&#xA;            {&#xA;                int response = avcodec_send_packet(inputCodecContext, &amp;packet);&#xA;&#xA;                while (response >= 0)&#xA;                {&#xA;                    response = avcodec_receive_frame(inputCodecContext, inputFrame);&#xA;                    if (response == AVERROR(EAGAIN) || response == AVERROR_EOF)&#xA;                    {&#xA;                        break;&#xA;                    }&#xA;                    else if (response &lt; 0)&#xA;                    {&#xA;                        std::cerr &lt;&lt; "Failed to receive frame from input decoder" &lt;&lt; std::endl;&#xA;                        break;&#xA;                    }&#xA;&#xA;                                        AVFrame *yuvFrame = av_frame_alloc();&#xA;                    av_image_alloc(yuvFrame->data, yuvFrame->linesize, codecContext->width, codecContext->height, codecContext->pix_fmt, 1);&#xA;&#xA;                    SwsContext *yuvSwsContext = sws_getContext(inputFrame->width, inputFrame->height, AV_PIX_FMT_RGB24,&#xA;                                                               codecContext->width, codecContext->height, codecContext->pix_fmt,&#xA;                                                               0, nullptr, nullptr, nullptr);&#xA;&#xA;                    sws_scale(yuvSwsContext, inputFrame->data, inputFrame->linesize, 0, inputFrame->height,&#xA;                              yuvFrame->data, yuvFrame->linesize);&#xA;&#xA;&#xA;                    memcpy(imageBuffer.data(), yuvFrame->data[0], codecContext->width * codecContext->height);&#xA;                    memcpy(imageBuffer.data() &#x2B; codecContext->width * codecContext->height, yuvFrame->data[1], codecContext->width * codecContext->height / 4);&#xA;                    memcpy(imageBuffer.data() &#x2B; codecContext->width * codecContext->height * 5 / 4, yuvFrame->data[2], codecContext->width * codecContext->height / 4);&#xA;&#xA;                    frame->data[0] = imageBuffer.data();&#xA;                    frame->data[1] = frame->data[0] &#x2B; codecContext->width * codecContext->height;&#xA;                    frame->data[2] = frame->data[1] &#x2B; codecContext->width * codecContext->height / 4;&#xA;                    frame->linesize[0] = codecContext->width;&#xA;                    frame->linesize[1] = codecContext->width / 2;&#xA;                    frame->linesize[2] = codecContext->width / 2;&#xA;                    frame->width = codecContext->width;&#xA;                    frame->height = codecContext->height;&#xA;                    frame->format = codecContext->pix_fmt;&#xA;                    frame->pts = av_rescale_q(videoStream->nb_frames, videoStream->time_base, videoStream->codec->time_base);&#xA;&#xA;                    av_init_packet(&amp;packet);&#xA;                    packet.data = nullptr;&#xA;                    packet.size = 0;&#xA;&#xA;                    avcodec_send_frame(codecContext, frame);&#xA;&#xA;                    while (avcodec_receive_packet(codecContext, &amp;packet) >= 0)&#xA;                    {&#xA;                        av_packet_rescale_ts(&amp;packet, codecContext->time_base, videoStream->time_base);&#xA;                        packet.stream_index = videoStream->index;&#xA;&#xA;                        av_write_frame(formatContext, &amp;packet);&#xA;                        av_packet_unref(&amp;packet);&#xA;                    }&#xA;&#xA;                    av_freep(&amp;yuvFrame->data[0]);&#xA;                    av_freep(&amp;yuvFrame);&#xA;                    sws_freeContext(yuvSwsContext);&#xA;                }&#xA;            }&#xA;&#xA;            av_packet_unref(&amp;packet);&#xA;        }&#xA;&#xA;        av_frame_free(&amp;inputFrame);&#xA;        avcodec_close(inputCodecContext);&#xA;        avformat_close_input(&amp;inputFormatContext);&#xA;    }&#xA;&#xA;    av_write_trailer(formatContext);&#xA;&#xA;    av_frame_free(&amp;frame);&#xA;    avcodec_close(codecContext);&#xA;    av_free(codecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;&#xA;</iomanip></algorithm></filesystem></thread></chrono></string></vector></iostream>

    &#xA;

    But the encoding format is mpeg, which cannot be opened in the player included with windows, and the prompt is an unsupported format.

    &#xA;

    Although the vlc player can be opened and played normally, I need to play it normally on the player that comes with windows, because the output video will be played on the browser.

    &#xA;

    So I changed AV_CODEC_ID_MPEG4 to AV_CODEC_ID_H264, and the result is that although the file size of the output image is very large, only one picture is displayed during playback. I don't know what the problem is.

    &#xA;

    I was thinking about writing a new one, but I had no idea how to write a new one.&#xA;I would appreciate it if someone could write me an example.

    &#xA;

  • FFMPEG = I tried resizing a video, but got different resolution than I wanted [closed]

    10 janvier 2024, par wakanasakai

    I downloaded a video that had some black bars (left & right), so I used the following command in FFmpeg to make various changes to it. I tested it on a 10 second clip to see what the result would look like.

    &#xA;

    -ss 00:04:44 -to 00:04:54 -vf "crop=1870:20:20:0","scale=640x480:flags=lanczos","eq=gamma=1.5:saturation=1.3:contrast=1.2"

    &#xA;

    The original video is an mp4, with a resolution of 1920 x 1080. Besides trying to crop it & adjust the gamma, saturation, & contrast, I also tried to resize it to 640 x 480. Instead, it's resulting resolution is 44880 x 480 ! I have a link to it for anybody who wants to examine it directly. (It's only 487 kb.)&#xA;text

    &#xA;

    I've tried using FFmpeg before, & it never did anything so insane. (It cropped it, & adjusted the gamma a saturation (I didn't test the contrast until THIS time), but it did not resize it at all.)

    &#xA;

    Here is FFmpeg's log file for it. Guesses as to the cause of the insane result, & advice on how to achieve the DESIRED result (in 1 pass, if possible) are requested.

    &#xA;

    ffmpeg -hwaccel auto -y -i "/storage/emulated/0/bluetooth/Barbie &amp; the Rockers=1080-Out of this world (1987).mp4" -ss 00:04:44 -to 00:04:54 -vf "crop=1870:20:20:0","scale=640x480:flags=lanczos","eq=gamma=1.5:saturation=1.3:contrast=1.2" "/storage/emulated/0/Movies/Barbie.mp4"&#xA;&#xA;ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 4.9.x (GCC) 20150123 (prerelease)&#xA;  configuration: --enable-version3 --enable-gpl --enable-nonfree --disable-indev=v4l2 --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libvorbis --enable-libtheora --enable-libopus --enable-libfdk-aac --enable-libfreetype --enable-libass --enable-libfribidi --enable-fontconfig --enable-pthreads --enable-libxvid --enable-filters --enable-openssl --enable-librtmp --disable-protocol=&#x27;udp,udplite&#x27; --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libvo-amrwbenc --enable-libspeex --enable-libsoxr --enable-libwebp --enable-libxml2 --enable-libopenh264 --enable-jni --prefix=/home/silentlexx/AndroidstudioProjects/ffmpeg/ffmpeg/build/arm-api18-r13b --sysroot=/home/silentlexx/Android/android-ndk-r13b/platforms/android-18/arch-arm --arch=arm --disable-shared --enable-static --enable-pic --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffnvcodec --disable-avdevice --disable-debug --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-symver --cross-prefix=/home/silentlexx/Android/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --target-os=android --enable-cross-compile --pkg-config-flags=--static --extra-libs=&#x27;-lgnustl_static -lm -lpng -l:libz.so -lpthread&#x27; --enable-asm --enable-neon --enable-small&#xA;  libavutil      58.  2.100 / 58.  2.100&#xA;  libavcodec     60.  3.100 / 60.  3.100&#xA;  libavformat    60.  3.100 / 60.  3.100&#xA;  libavfilter     9.  3.100 /  9.  3.100&#xA;  libswscale      7.  1.100 /  7.  1.100&#xA;  libswresample   4. 10.100 /  4. 10.100&#xA;  libpostproc    57.  1.100 / 57.  1.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/storage/emulated/0/bluetooth/Barbie &amp; the Rockers=1080-Out of this world (1987).mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 512&#xA;    compatible_brands: mp41isomiso2&#xA;    creation_time   : 2024-01-04T01:46:07.000000Z&#xA;  Duration: 00:45:33.10, start: 0.000000, bitrate: 3404 kb/s&#xA;  Stream #0:0[0x1](und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3272 kb/s, 30 fps, 30 tbr, 15360 tbn (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-06-25T13:25:03.000000Z&#xA;      vendor_id       : [0][0][0][0]&#xA;  Stream #0:1[0x2](eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-06-25T13:25:03.000000Z&#xA;      vendor_id       : [0][0][0][0]&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (aac (native) -> aac (native))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 0xf38cd180] using SAR=561/8&#xA;[libx264 @ 0xf38cd180] using cpu capabilities: ARMv6 NEON&#xA;[libx264 @ 0xf38cd180] profile High, level 3.0, 4:2:0, 8-bit&#xA;[libx264 @ 0xf38cd180] 264 - core 158 r2984 3759fcb - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;Output #0, mp4, to &#x27;/storage/emulated/0/Movies/Barbie.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 512&#xA;    compatible_brands: mp41isomiso2&#xA;    encoder         : Lavf60.3.100&#xA;  Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 640x480 [SAR 561:8 DAR 187:2], q=2-31, 30 fps, 15360 tbn (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-06-25T13:25:03.000000Z&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc60.3.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;  Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-06-25T13:25:03.000000Z&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc60.3.100 aac&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.16 bitrate=   2.4kbits/s speed=0.00197x    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.71 bitrate=   0.5kbits/s speed=0.00867x    &#xA;frame=   13 fps=0.2 q=29.0 size=       0kB time=00:00:01.48 bitrate=   0.3kbits/s speed=0.0178x    &#xA;frame=   45 fps=0.5 q=29.0 size=       0kB time=00:00:02.55 bitrate=   0.2kbits/s speed=0.0304x    &#xA;frame=   78 fps=0.9 q=29.0 size=       0kB time=00:00:03.66 bitrate=   0.1kbits/s speed=0.0434x    &#xA;frame=  114 fps=1.3 q=29.0 size=       0kB time=00:00:04.85 bitrate=   0.1kbits/s speed=0.057x    &#xA;frame=  146 fps=1.7 q=29.0 size=       0kB time=00:00:05.92 bitrate=   0.1kbits/s speed=0.0692x    &#xA;frame=  178 fps=2.1 q=29.0 size=       0kB time=00:00:07.03 bitrate=   0.1kbits/s speed=0.0817x    &#xA;frame=  209 fps=2.4 q=29.0 size=     256kB time=00:00:08.03 bitrate= 261.1kbits/s speed=0.0928x    &#xA;frame=  240 fps=2.8 q=29.0 size=     256kB time=00:00:09.07 bitrate= 231.0kbits/s speed=0.104x    &#xA;frame=  300 fps=3.4 q=-1.0 Lsize=     445kB time=00:00:09.98 bitrate= 365.2kbits/s speed=0.114x    &#xA;video:275kB audio:159kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.692692%&#xA;[libx264 @ 0xf38cd180] frame I:10    Avg QP:20.34  size:  2434&#xA;[libx264 @ 0xf38cd180] frame P:129   Avg QP:21.89  size:  1292&#xA;[libx264 @ 0xf38cd180] frame B:161   Avg QP:21.69  size:   555&#xA;[libx264 @ 0xf38cd180] consecutive B-frames: 20.0% 18.7% 20.0% 41.3%&#xA;[libx264 @ 0xf38cd180] mb I  I16..4: 30.2% 66.5%  3.2%&#xA;[libx264 @ 0xf38cd180] mb P  I16..4: 14.3% 17.7%  0.2%  P16..4: 12.7%  2.7%  0.4%  0.0%  0.0%    skip:52.1%&#xA;[libx264 @ 0xf38cd180] mb B  I16..4:  2.1%  1.1%  0.0%  B16..8: 21.9%  1.7%  0.0%  direct: 1.5%  skip:71.6%  L0:46.0% L1:53.0% BI: 1.0%&#xA;[libx264 @ 0xf38cd180] 8x8 transform intra:54.9% inter:98.2%&#xA;[libx264 @ 0xf38cd180] coded y,uvDC,uvAC intra: 10.3% 14.9% 1.5% inter: 2.2% 5.4% 0.0%&#xA;[libx264 @ 0xf38cd180] i16 v,h,dc,p: 93%  2%  2%  4%&#xA;[libx264 @ 0xf38cd180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 69%  1% 28%  0%  0%  1%  0%  0%  0%&#xA;[libx264 @ 0xf38cd180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 76%  3% 17%  1%  1%  2%  0%  1%  0%&#xA;[libx264 @ 0xf38cd180] i8c dc,h,v,p: 45%  2% 53%  1%&#xA;[libx264 @ 0xf38cd180] Weighted P-Frames: Y:0.8% UV:0.8%&#xA;[libx264 @ 0xf38cd180] ref P L0: 57.0%  8.7% 24.0% 10.4%&#xA;[libx264 @ 0xf38cd180] ref B L0: 79.7% 17.3%  3.0%&#xA;[libx264 @ 0xf38cd180] ref B L1: 95.6%  4.4%&#xA;[libx264 @ 0xf38cd180] kb/s:224.32&#xA;[aac @ 0xf38cd880] Qavg: 457.489&#xA;

    &#xA;

  • ffmpeg concat skips frames near end of each subclip

    3 janvier 2024, par calvinusesyourcode

    So I have some video files to concat but in the resulting video the last few frames of each subclip are buggy. Imagine in the last 5 frames the first 3 frames are skipped and so at the end of each clip it seems to jitter.

    &#xA;

    It should be virtually impossible for my input videos to have any differences between them, as they were all recorded on the same iPhone and all converted with the same command :

    &#xA;

    command = [&#xA;            &#x27;ffmpeg&#x27;, &#x27;-y&#x27;,&#xA;            &#x27;-i&#x27;, input_path,&#xA;            &#x27;-vf&#x27;, &#x27;scale=1080:1920&#x27;,&#xA;            &#x27;-r&#x27;, &#x27;30&#x27;,&#xA;            &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;            output_path&#xA;        ]&#xA;subprocess.run(command, check=True)&#xA;

    &#xA;

    I have tried re-encoding instead of merely copying and adding -r 30 but that doesn't seem to work.

    &#xA;

    subprocess.run(["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", temp_textfile, "-c", "copy", output_path])&#xA;

    &#xA;

        subprocess.run(["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", temp_textfile, "-r", "30", "-c:v", "libx264", "-c:a", "aac", output_path], check=True)&#xA;

    &#xA;

    Somewhere someone said to open in VLC and do a frame-by-frame, reporting that "the frames are actually there, just not visually when watching normally". In my case the frame-by-frame reveals the frames are indeed being skipped.

    &#xA;

    Full console output :

    &#xA;

    ffmpeg version 2023-05-18-git-01d9a84ef5-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)&#xA;  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-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --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 &#xA;--enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint&#xA;  libavutil      58.  7.100 / 58.  7.100&#xA;  libavcodec     60. 14.100 / 60. 14.100&#xA;  libavformat    60.  5.100 / 60.  5.100&#xA;  libavdevice    60.  2.100 / 60.  2.100&#xA;  libavfilter     9.  8.100 /  9.  8.100&#xA;  libswscale      7.  2.100 /  7.  2.100&#xA;  libswresample   4. 11.100 /  4. 11.100&#xA;  libpostproc    57.  2.100 / 57.  2.100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d60610ebc0] Auto-inserting h264_mp4toannexb bitstream filter&#xA;Input #0, concat, from &#x27;run\broll_subclips.txt&#x27;:&#xA;  Duration: N/A, start: -0.023220, bitrate: 3094 kb/s&#xA;  Stream #0:0(und): Video: h264 (High 10) (avc1 / 0x31637661), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67, progressive), 1080x1920, 2968 kb/s, 30 fps, 30 tbr, 15360 tbn&#xA;    Metadata:&#xA;      handler_name    : Core Media Video&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc60.14.100 libx264&#xA;  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s&#xA;    Metadata:&#xA;      handler_name    : Core Media Audio&#xA;      vendor_id       : [0][0][0][0]&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (aac (native) -> aac (native))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 000001d6066fd380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX &#xA;FMA3 BMI2 AVX2&#xA;[libx264 @ 000001d6066fd380] profile High 10, level 4.0, 4:2:0, 10-bit&#xA;[libx264 @ 000001d6066fd380] 264 - core 164 r3107 a8b68eb - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=81 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;Output #0, mp4, to &#x27;joined_clips.mp4&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf60.5.100&#xA;  Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67, progressive), 1080x1920, q=2-31, 30 fps, 15360 tbn&#xA;    Metadata:&#xA;      handler_name    : Core Media Video&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc60.14.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s&#xA;    Metadata:&#xA;      handler_name    : Core Media Audio&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc60.14.100 aac&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.23 bitrate=   1.7kbits/s dup[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:01.97 bitrate=   0.2kbits/s dupframe=   42 fps= 41 q=41.0 size=     256kB time=00:00:01.97 bitrate=1062.7kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=   81 fps= 53 q=41.0 size=     768kB time=00:00:04.71 bitrate=1334.8kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  124 fps= 61 q=41.0 size=    1280kB time=00:00:06.10 bitrate=1717.1kbits/s duframe=  178 fps= 69 q=38.0 size=    1536kB time=00:00:07.96 bitrate=1579.9kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  235 fps= 76 q=41.0 size=    2048kB time=00:00:09.84 bitrate=1704.1kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  273 fps= 76 q=41.0 size=    2560kB time=00:00:11.12 bitrate=1885.5kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  309 fps= 75 q=41.0 size=    2816kB time=00:00:12.30 bitrate=1874.5kbits/s duframe=  354 fps= 77 q=41.0 size=    3328kB time=00:00:13.83 bitrate=1969.9kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  411 fps= 80 q=41.0 size=    3840kB time=00:00:15.72 bitrate=2001.1kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  479 fps= 85 q=41.0 size=    4096kB time=00:00:17.99 bitrate=1864.6kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d608de8100] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  515 fps= 84 q=41.0 size=    4608kB time=00:00:19.20 bitrate=1965.7kbits/s duframe=  549 fps= 81 q=41.0 size=    4864kB time=00:00:20.31 bitrate=1961.1kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d60c3e8d40] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  600 fps= 83 q=41.0 size=    5632kB time=00:00:22.03 bitrate=2093.7kbits/s du[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d60c3e8d40] Auto-inserting h264_mp4toannexb bitstream filter&#xA;frame=  648 fps= 83 q=41.0 size=    5888kB time=00:00:23.61 bitrate=2042.5kbits/s du[out#0/mp4 @ 000001d6061163c0] video:6385kB audio:335kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.377336%&#xA;frame=  724 fps= 86 q=-1.0 Lsize=    6746kB time=00:00:24.03 bitrate=2299.4kbits/s dup=6 drop=2 speed=2.86x&#xA;[libx264 @ 000001d6066fd380] frame I:12    Avg QP:26.96  size: 87427&#xA;[libx264 @ 000001d6066fd380] frame P:191   Avg QP:32.28  size: 15534&#xA;[libx264 @ 000001d6066fd380] frame B:521   Avg QP:35.40  size:  4840&#xA;[libx264 @ 000001d6066fd380] consecutive B-frames:  2.9%  2.8%  2.1% 92.3%&#xA;[libx264 @ 000001d6066fd380] mb I  I16..4: 21.0% 56.5% 22.5%&#xA;[libx264 @ 000001d6066fd380] mb P  I16..4:  1.9%  6.3%  1.0%  P16..4: 25.0%  4.5%  2.2%  0.0%  0.0%    skip:59.1%&#xA;[libx264 @ 000001d6066fd380] mb B  I16..4:  0.2%  0.7%  0.1%  B16..8: 24.4%  1.8%  0.2%  direct: 0.3%  skip:72.3%  L0:46.0% L1:50.7% BI: 3.3%&#xA;[libx264 @ 000001d6066fd380] 8x8 transform intra:64.9% inter:79.1%&#xA;[libx264 @ 000001d6066fd380] coded y,uvDC,uvAC intra: 42.4% 26.9% 3.0% inter: 3.7% 0.9% 0.0%&#xA;[libx264 @ 000001d6066fd380] i16 v,h,dc,p: 25% 28% 12% 35%&#xA;[libx264 @ 000001d6066fd380] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 23%  5%  6%  6% &#xA; 6%  6%  6%&#xA;[libx264 @ 000001d6066fd380] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 21% 19%  5%  6%  6% &#xA; 7%  5%  5%&#xA;[libx264 @ 000001d6066fd380] i8c dc,h,v,p: 71% 13% 13%  4%&#xA;[libx264 @ 000001d6066fd380] Weighted P-Frames: Y:0.0% UV:0.0%&#xA;[libx264 @ 000001d6066fd380] ref P L0: 68.7% 17.8% 13.4%&#xA;[libx264 @ 000001d6066fd380] ref B L0: 88.4%  9.1%  2.5%&#xA;[libx264 @ 000001d6066fd380] ref B L1: 96.9%  3.1%&#xA;[libx264 @ 000001d6066fd380] kb/s:2167.24&#xA;[aac @ 000001d606184b40] Qavg: 346.828&#xA;

    &#xA;

    UPDATE : I am thinking that the way I am converting my files from .mov to .mp4 is the problem. Please suggest the best way to convert from iPhone 4k 60fps .mov files to nice 1080p 30fps .mp4 files. I know I could just use handbrake but I am trying to be a man here xD. Perhaps handbrake has a View ffmpeg code for conversion.

    &#xA;

    UPDATE 2 : re-encoding the videos before concat with -c:v libx264 fixes the problem... which seems weird because that is how they were originally encoded...

    &#xA;

    def join_broll(video_paths, desired_length, clip_length=None, output_path="quick_clips.mp4", preserve_inputs=True):&#xA;    subclips = []&#xA;    total_duration = 0&#xA;&#xA;    temp_textfile = os.path.join(run_folder, "broll_subclips.txt")&#xA;    j = 0&#xA;    with open(temp_textfile, "w") as file:&#xA;        while True:&#xA;            for i, video_path in enumerate(video_paths):&#xA;&#xA;                time_left = desired_length - total_duration&#xA;                video_duration = duration_of(video_path)&#xA;                subclip_path = f"subclip_{i&#x2B;j}.mp4"&#xA;&#xA;                if (not clip_length and video_duration &lt; time_left) or (clip_length and clip_length &lt; time_left):&#xA;&#xA;                    if clip_length:&#xA;&#xA;                        subclips.append(subclip_path)&#xA;                        subprocess.run(["ffmpeg", "-y", "-i", video_path, "-t", str(clip_length), "-c:v", "libx264", subclip_path]) # added "-c:v libx264"&#xA;                        total_duration &#x2B;= clip_length&#xA;                        file.write(f"file &#x27;{os.path.join(&#x27;..&#x27;, subclip_path)}&#x27;\n")&#xA;&#xA;                    else:&#xA;                    &#xA;                        subclips.append(subclip_path)&#xA;                        subprocess.run(["ffmpeg", "-y", "-i", video_path, "-c:v", "libx264", subclip_path]) # added "-c:v libx264"&#xA;                        total_duration &#x2B;= video_duration&#xA;                        file.write(f"file &#x27;{subclip_path}&#x27;\n")&#xA;&#xA;                else:&#xA;&#xA;                    subclips.append(subclip_path)&#xA;                    subprocess.run(["ffmpeg", "-y", "-i", video_path, "-t", str(time_left), "-c:v", "libx264", subclip_path]) # added "-c:v libx264"&#xA;                    total_duration &#x2B;= time_left&#xA;                    file.write(f"file &#x27;{os.path.join(&#x27;..&#x27;, subclip_path)}&#x27;\n")&#xA;&#xA;                    break&#xA;&#xA;            j &#x2B;= 1&#xA;            if desired_length - total_duration &lt; 0.1:&#xA;                break&#xA;                &#xA;&#xA;    subprocess.run(["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", temp_textfile, "-c", "copy", output_path])&#xA;    # subprocess.run(["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", temp_textfile, "-r", "30", "-c:v", "libx264", "-c:a", "aac", output_path], check=True)&#xA;    return output_path&#xA;

    &#xA;