
Recherche avancée
Médias (1)
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (74)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP 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 (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (7458)
-
Upload FFmpeg output directly to Amazon S3
26 octobre 2017, par user1790300I am using the fluent-ffmpeg library with node.js to transcode videos originally in a flash movie format to the mp3 format with multiple resolutions, 1080p, etc.. Once the transcoding is complete, I would like to move the transcoded video to an s3 bucket.
I pull the original .flv file from a source s3 bucket and pass the stream to the ffmpeg constructor function. The issue is after the transcoding completes, how do I then get the stream of the mp4 data to send to s3.
Here is the code I have so far :
var params = {
Bucket: process.env.SOURCE_BUCKET,
Key: fileName
};
s3.getObject(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
var format = ffmpeg(data)
.size('854x480')
.videoCodec('libx264')
.format('flv')
.toFormat('mp4');
.on('end', function () {
//Ideally, I would like to do the uploading here
var params = {
Body: //{This is my confusion, how do I get the stream to add here?},
Bucket: process.env.TRANSCODED_BUCKET,
Key: fileName
};
s3.putObject(params, function (err, data) {
});
})
.on('error', function (err) {
console.log('an error happened: ' + err.message);
});
});For the code above, where can I get the transcoded stream to add to the "Body" property of the params object ?
Update :
Here is a revision of what I am trying to do :
var outputStream: MemoryStream = new MemoryStream();
var proc = ffmpeg(currentStream)
.size('1920x1080')
.videoCodec('libx264')
.format('avi')
.toFormat('mp4')
.output(outputStream)
// setup event handlers
.on('end', function () {
uploadFile(outputStream, "").then(function(){
resolve();
})
})
.on('error', function (err) {
console.log('an error happened: ' + err.message);
});I would like to avoid copying the file to the local filesystem from s3, rather I would prefer to process the file in memory and upload back to s3 when finished. Would fluent-ffmpeg allow this scenario ?
-
Code can not read property 1 of undefined [closed]
25 mai 2023, par Jesse CopasI'm a very new programmer and am working on a Tdarr plugin in JS.
Everything works fine until a 4k file tries to get transcoded and it fails with this log


2023-05-24T19:09:54.906Z ZoBKWMMKG:Node\[hidden-hog\]:Worker\[tall-tuna\]:{"pluginInputs":{"BitRate":"4000","ResolutionSelection":"1080p","Container":"mkv","AudioType":"AAC","FrameRate":"24"}}

2023-05-24T19:09:54.907Z ZoBKWMMKG:Node\[hidden-hog\]:Worker\[tall-tuna\]:Error TypeError: Cannot read property '1' of undefined



It's saying that it's unable to read property 1 of undefined and I'm looked and looked and looked and can't find what it is referring to. Hoping to get another set of eyes on it
The plugin Code is here


/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
/* eslint-disable no-restricted-globals */
const details = () => ({
 id: 'Tdarr_Plugin_Jeso_AV1_HandBrake_Transcode',
 Stage: 'Pre-processing',
 Name: 'AV1 HandBrake Transcoder',
 Type: 'Video',
 Operation: 'Transcode',
 Description: 'Transcodes to AV1 at the selected Bitrate. This is best used with Remux Files.',
 Version: '2.1.3',
 Tags: 'HandBrake,configurable',
 Inputs: [
 {
 name: 'BitRate',
 type: 'string',
 defaultValue: '4000',
 inputUI: {
 type: 'text',
 },
 tooltip: `
 ~ Requested Bitrate ~ \\n
 Put in the Bitrate you want to process to in Kbps. For example 4000Kbps is 4Mbps. `,
 },
 {
 name: 'ResolutionSelection',
 type: 'string',
 defaultValue: '1080p',
 inputUI: {
 type: 'dropdown',
 options: [
 '8KUHD',
 '4KUHD',
 '1080p',
 '720p',
 '480p',
 ],
 },
 // eslint-disable-next-line max-len
 tooltip: 'Any Resolution larger than this will become this Resolution same as the bitrate if the Res is lower than the selected it will use the res of the file as to not cause bloating of file size.',
 },
 {
 name: 'Container',
 type: 'string',
 defaultValue: 'mkv',
 inputUI: {
 type: 'dropdown',
 options: [
 'mp4',
 'mkv',
 ],
 },
 tooltip: ` Container Type \\n\\n
 mkv or mp4.\\n`,
 },
 {
 name: 'AudioType',
 type: 'string',
 defaultValue: 'AAC',
 inputUI: {
 type: 'dropdown',
 options: [
 'AAC',
 'EAC3',
 'MP3',
 'Vorbis',
 'Flac16',
 'Flac24',
 ],
 },
 // eslint-disable-next-line max-len
 tooltip: 'Set Audio container type that you want to use',
 },
 {
 name: 'FrameRate',
 type: 'string',
 defaultValue: '24',
 inputUI: {
 type: 'text',
 },
 // eslint-disable-next-line max-len
 tooltip: 'If the files framerate is higher than 24 and you want to maintain that framerate you can do so here',
 },
 ],
});
const MediaInfo = {
 videoHeight: '',
 videoWidth: '',
 videoFPS: '',
 videoBR: '',
 videoBitDepth: '',
 overallBR: '',
 videoResolution: '',
}; // var MediaInfo
// Easier for our functions if response has global scope.
const response = {
 processFile: false,
 preset: '',
 container: '.mkv',
 handBrakeMode: true,
 FFmpegMode: false,
 reQueueAfter: true,
 infoLog: '',
}; // var response
// Finds the first video stream and populates some useful variables
function getMediaInfo(file) {
 let videoIdx = -1;
 for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
 const strstreamType = file.ffProbeData.streams[i].codec_type.toLowerCase();
 // Looking For Video
 // Check if stream is a video.
 if (videoIdx === -1 && strstreamType === 'video') {
 videoIdx = i;
 // get video streams resolution
 MediaInfo.videoResolution = `${file.ffProbeData.streams[i].height}x${file.ffProbeData.streams[i].width}`;
 MediaInfo.videoHeight = Number(file.ffProbeData.streams[i].height);
 MediaInfo.videoWidth = Number(file.ffProbeData.streams[i].width);
 MediaInfo.videoFPS = Number(file.mediaInfo.track[i + 1].FrameRate) || 25;
 // calulate bitrate from dimensions and fps of file
 MediaInfo.videoBR = (MediaInfo.videoHeight * MediaInfo.videoWidth * MediaInfo.videoFPS * 0.08).toFixed(0);
 }
 }
} // end getMediaInfo()
// define resolution order from ResolutionSelection from biggest to smallest
const resolutionOrder = ['8KUHD', '4KUHD', '1080p', '720p', '480p'];
// define the width and height of each resolution from the resolution order
const resolutionsdimensions = {
 '8KUHD': '--width 7680 --height 4320',
 '4KUHD': '--width 3840 --height 2160',
 '1080p': '--width 1920 --height 1080',
 '720p': '--width 1280 --height 720',
 '480p': '--width 640 --height 480',
};
// eslint-disable-next-line no-unused-vars
const plugin = (file, librarySettings, inputs) => {
 // eslint-disable-next-line no-unused-vars
 const importFresh = require('import-fresh');
 // eslint-disable-next-line no-unused-vars
 const library = importFresh('../methods/library.js');
 // eslint-disable-next-line no-unused-vars
 const lib = require('../methods/lib')();
 // Get the selected resolution from the 'ResolutionSelection' variable
 const selectedResolution = inputs.ResolutionSelection;
 getMediaInfo(file);
 // use mediainfo to match height and width to a resolution on resolutiondimensions
 let dimensions = resolutionsdimensions[selectedResolution];
 // if the file is smaller than the selected resolution then use the file resolution
 if (MediaInfo.videoHeight < dimensions.split(' ')[3] || MediaInfo.videoWidth < dimensions.split(' ')[1]) {
 dimensions = `--width ${MediaInfo.videoWidth} --height ${MediaInfo.videoHeight}`;
 // eslint-disable-next-line brace-style
 }
 // read the bitrate of the video stream
 let videoBitRate = MediaInfo.videoBR;
 // if videoBitrate is over 1000000 devide by 100 to get the bitrate in Kbps
 if (videoBitRate > 1000000) {
 videoBitRate /= 100;
 } else { videoBitRate /= 1000; }
 // if VideoBitrate is smaller than selected bitrate then use the videoBitrate
 if (videoBitRate < inputs.BitRate) {
 // eslint-disable-next-line no-param-reassign
 inputs.BitRate = videoBitRate;
 // eslint-disable-next-line brace-style
 }
 // if VideoBitrate is larger than selected bitrate then use the selected bitrate
 else {
 // eslint-disable-next-line no-self-assign, no-param-reassign
 inputs.BitRate = inputs.BitRate;
 }

 //Skip Transcoding if File is already AV1
 if (file.ffProbeData.streams[0].codec_name === 'av1') {
 response.processFile = false;
 response.infoLog += 'File is already AV1 \n';
 return response;
 }
 // eslint-disable-next-line no-constant-condition
 if ((true) || file.forceProcessing === true) {
 // eslint-disable-next-line max-len
 response.preset = `--encoder svt_av1 -b ${inputs.BitRate} -r ${inputs.FrameRate} -E ${inputs.AudioType} -f ${inputs.Container} --no-optimize ${dimensions} --crop 0:0:0:0`;
 response.container = `.${inputs.Container}`;
 response.handbrakeMode = true;
 response.ffmpegMode = false;
 response.processFile = true;
 response.infoLog += `File is being transcoded at ${inputs.BitRate} Kbps to ${dimensions} as ${inputs.Container} \n`;
 return response;
 }
 response.infoLog += 'File is being transcoded using custom arguments \n';
 return response;
};
 };

module.exports.details = details;
module.exports.plugin = plugin;



Tried transcoding 4k files down to 1080p but it fails due to that undefined error. All Res 1080p and lower that I have tried work correctly


EDIT : I used Console.log and got this back


[2023-05-24T23:29:51.001] [ERROR] Tdarr_Server - Error running MediaInfo 1
[2023-05-24T23:29:51.004] [ERROR] Tdarr_Server - RangeError: Maximum call stack size exceeded
 at x (<anonymous>:wasm-function[381]:0x15c4d)
 at <anonymous>:wasm-function[46]:0x5dc0
 at <anonymous>:wasm-function[652]:0x21cb9
 at <anonymous>:wasm-function[1023]:0x47018
 at <anonymous>:wasm-function[853]:0x37827
 at <anonymous>:wasm-function[3684]:0xf4884
 at <anonymous>:wasm-function[3516]:0xeb5b7
 at <anonymous>:wasm-function[1061]:0x487c9
 at <anonymous>:wasm-function[795]:0x3006d
 at <anonymous>:wasm-function[3628]:0xf01cc
[2023-05-24T23:29:51.006] [ERROR] Tdarr_Server - Error running MediaInfo 2
[2023-05-24T23:29:51.006] [ERROR] Tdarr_Server - RangeError: Maximum call stack size exceeded
 at x (<anonymous>:wasm-function[381]:0x15c4d)
 at <anonymous>:wasm-function[46]:0x5dc0
 at <anonymous>:wasm-function[652]:0x21cb9
 at <anonymous>:wasm-function[1023]:0x47018
 at <anonymous>:wasm-function[853]:0x37827
 at <anonymous>:wasm-function[3684]:0xf4884
 at <anonymous>:wasm-function[3516]:0xeb5b7
 at <anonymous>:wasm-function[1061]:0x487c9
 at <anonymous>:wasm-function[795]:0x3006d
 at <anonymous>:wasm-function[3628]:0xf01cc
[2023-05-24T23:29:58.220] [ERROR] Tdarr_Server - Error running MediaInfo 1
[2023-05-24T23:29:58.223] [ERROR] Tdarr_Server - RangeError: Maximum call stack size exceeded
 at x (<anonymous>:wasm-function[381]:0x15c4d)
 at <anonymous>:wasm-function[46]:0x5dc0
 at <anonymous>:wasm-function[652]:0x21cb9
 at <anonymous>:wasm-function[1023]:0x47018
 at <anonymous>:wasm-function[853]:0x37827
 at <anonymous>:wasm-function[3684]:0xf4884
 at <anonymous>:wasm-function[3516]:0xeb5b7
 at <anonymous>:wasm-function[1061]:0x487c9
 at <anonymous>:wasm-function[795]:0x3006d
 at <anonymous>:wasm-function[3628]:0xf01cc
[2023-05-24T23:29:58.224] [ERROR] Tdarr_Server - Error running MediaInfo 2
[2023-05-24T23:29:58.224] [ERROR] Tdarr_Server - RangeError: Maximum call stack size exceeded
 at x (<anonymous>:wasm-function[381]:0x15c4d)
 at <anonymous>:wasm-function[46]:0x5dc0
 at <anonymous>:wasm-function[652]:0x21cb9
 at <anonymous>:wasm-function[1023]:0x47018
 at <anonymous>:wasm-function[853]:0x37827
 at <anonymous>:wasm-function[3684]:0xf4884
 at <anonymous>:wasm-function[3516]:0xeb5b7
 at <anonymous>:wasm-function[1061]:0x487c9
 at <anonymous>:wasm-function[795]:0x3006d
 at <anonymous>:wasm-function[3628]:0xf01cc
</anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous></anonymous>


-
ffmpeg concat skips frames near end of each subclip
3 janvier 2024, par calvinusesyourcodeSo 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.


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 :


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



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

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



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



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.


Full console output :


ffmpeg version 2023-05-18-git-01d9a84ef5-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 12.2.0 (Rev10, 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-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 
--enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
 libavutil 58. 7.100 / 58. 7.100
 libavcodec 60. 14.100 / 60. 14.100
 libavformat 60. 5.100 / 60. 5.100
 libavdevice 60. 2.100 / 60. 2.100
 libavfilter 9. 8.100 / 9. 8.100
 libswscale 7. 2.100 / 7. 2.100
 libswresample 4. 11.100 / 4. 11.100
 libpostproc 57. 2.100 / 57. 2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d60610ebc0] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'run\broll_subclips.txt':
 Duration: N/A, start: -0.023220, bitrate: 3094 kb/s
 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
 Metadata:
 handler_name : Core Media Video
 vendor_id : [0][0][0][0]
 encoder : Lavc60.14.100 libx264
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s
 Metadata:
 handler_name : Core Media Audio
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000001d6066fd380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX 
FMA3 BMI2 AVX2
[libx264 @ 000001d6066fd380] profile High 10, level 4.0, 4:2:0, 10-bit
[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
Output #0, mp4, to 'joined_clips.mp4':
 Metadata:
 encoder : Lavf60.5.100
 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67, progressive), 1080x1920, q=2-31, 30 fps, 15360 tbn
 Metadata:
 handler_name : Core Media Video
 vendor_id : [0][0][0][0]
 encoder : Lavc60.14.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
 Metadata:
 handler_name : Core Media Audio
 vendor_id : [0][0][0][0]
 encoder : Lavc60.14.100 aac
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
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
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
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
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
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
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
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
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
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
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
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%
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
[libx264 @ 000001d6066fd380] frame I:12 Avg QP:26.96 size: 87427
[libx264 @ 000001d6066fd380] frame P:191 Avg QP:32.28 size: 15534
[libx264 @ 000001d6066fd380] frame B:521 Avg QP:35.40 size: 4840
[libx264 @ 000001d6066fd380] consecutive B-frames: 2.9% 2.8% 2.1% 92.3%
[libx264 @ 000001d6066fd380] mb I I16..4: 21.0% 56.5% 22.5%
[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%
[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%
[libx264 @ 000001d6066fd380] 8x8 transform intra:64.9% inter:79.1%
[libx264 @ 000001d6066fd380] coded y,uvDC,uvAC intra: 42.4% 26.9% 3.0% inter: 3.7% 0.9% 0.0%
[libx264 @ 000001d6066fd380] i16 v,h,dc,p: 25% 28% 12% 35%
[libx264 @ 000001d6066fd380] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 23% 5% 6% 6% 
 6% 6% 6%
[libx264 @ 000001d6066fd380] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 21% 19% 5% 6% 6% 
 7% 5% 5%
[libx264 @ 000001d6066fd380] i8c dc,h,v,p: 71% 13% 13% 4%
[libx264 @ 000001d6066fd380] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001d6066fd380] ref P L0: 68.7% 17.8% 13.4%
[libx264 @ 000001d6066fd380] ref B L0: 88.4% 9.1% 2.5%
[libx264 @ 000001d6066fd380] ref B L1: 96.9% 3.1%
[libx264 @ 000001d6066fd380] kb/s:2167.24
[aac @ 000001d606184b40] Qavg: 346.828



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
.

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...

def join_broll(video_paths, desired_length, clip_length=None, output_path="quick_clips.mp4", preserve_inputs=True):
 subclips = []
 total_duration = 0

 temp_textfile = os.path.join(run_folder, "broll_subclips.txt")
 j = 0
 with open(temp_textfile, "w") as file:
 while True:
 for i, video_path in enumerate(video_paths):

 time_left = desired_length - total_duration
 video_duration = duration_of(video_path)
 subclip_path = f"subclip_{i+j}.mp4"

 if (not clip_length and video_duration < time_left) or (clip_length and clip_length < time_left):

 if clip_length:

 subclips.append(subclip_path)
 subprocess.run(["ffmpeg", "-y", "-i", video_path, "-t", str(clip_length), "-c:v", "libx264", subclip_path]) # added "-c:v libx264"
 total_duration += clip_length
 file.write(f"file '{os.path.join('..', subclip_path)}'\n")

 else:
 
 subclips.append(subclip_path)
 subprocess.run(["ffmpeg", "-y", "-i", video_path, "-c:v", "libx264", subclip_path]) # added "-c:v libx264"
 total_duration += video_duration
 file.write(f"file '{subclip_path}'\n")

 else:

 subclips.append(subclip_path)
 subprocess.run(["ffmpeg", "-y", "-i", video_path, "-t", str(time_left), "-c:v", "libx264", subclip_path]) # added "-c:v libx264"
 total_duration += time_left
 file.write(f"file '{os.path.join('..', subclip_path)}'\n")

 break

 j += 1
 if desired_length - total_duration < 0.1:
 break
 

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