
Recherche avancée
Médias (1)
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (82)
-
Ecrire une actualité
21 juin 2013, parPré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 ) (...) -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (9007)
-
ffmpeg - concatenate large set of video files - file names
5 avril 2023, par bunnyisblackI'm trying to concatenate multiple video files. They all use the same codec and frame rate. Anyway concatenation isn't a problem. I've done it before.


The problem is to automate it ?


The answer here shows method 2 to be used in windows to concatenate files.
It's really easy :


(echo file 'first file.mp4' & echo file 'second file.mp4' )>list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy output.mp4



First, we make a list of video files (by manually tying them out). Second, we execute.


The problem is that I have multiple video files located in a single directory. The video files are named similar to this :


\450_01_videoName.mp4
\450_02_videoNameFoo.mp4
\450_04_videoNameMoo.mp4
\451_01_videoNameRoo.mp4
\451_02_videoNameHoo.mp4



Now look at the above list and imagine that it's 200 lines big in a single folder. I'm trying to concatenate video 450 into 1, then video 451 into 1 file, etc.


I'm trying to automate this process with a good thousand video files.


I can do it semi manually. Use cmd to create a list of file and folder path. But then I would manually, file by file, have to copy and paste it to create that list.txt.


Is there a way to automate this ? I've done this manually with 20 video files and it was painful (but better then using a stand alone software, as all the videos were done in a batch after all was set up).


Cheers.


I've done the process semi manually. It worked, but took more time that it needs to take.


------UPDATE


This is how I tackled the problem. It was slow and painful.


Firslty, I used cmd "dir /b > file.txt" to extract all the names of video files in that directory.


Then I painfully wrote the BAT file manually (for videos up to 500) for each video I wanted to merge. I used a few notepad++ shortcuts, for example, replacing the number '45' with 'echo file 45', this ensured I didn't need to type 'echo file' manually for every line. Then I also copy-pasted manually for every line '>>list.txt'. I painfully had to write out the output file name 50 different times.


h:
cd "h:\video directory"
echo file 450_01_video.mp4 > list.txt
echo file 450_02_videoMoo.mp4 >> list.txt
echo file 450_03_videoFoo.mp4 >> list.txt
echo file 450_04_videoLoo.mp4 >> list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy 450Video.mp4
echo file 451_01_video.mp4 > list.txt
echo file 451_02_videoMoo.mp4 >> list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy 451Video.mp4



Now imagine a line for every single video file that I had to do manually.


There has to be a simple for loop solution.


ANSWER - SOLVED


I've used Armali's solution.


h:
cd "h:\video directory"

SETLOCAL ENABLEDELAYEDEXPANSION
set number=999
for %%f in (???_*.mp4) do (
 set name=%%f
 set before=!number!
 set number=!name:~0,3!
 if !number! gtr !before! call :concat
 echo file !name! >>list.txt
)

:concat
 ffmpeg -safe 0 -f concat -i list.txt -c copy %before%Video.mp4
 del list.txt



The output video files were named 412Video.mp4. I used the
dir /b file.txt
command to extract the list of original files. I then copied them into excel, delimited them and used the tricks to extract the number, name, and remove duplicates etc. I then combined each record with output video as a ren command. E.g. ren 412video.mp4 412.name.location.mp4. I copied that into cmd for a fast rename.

-
ffmpeg wrong framerate when converting x264 to x265
11 avril 2023, par AndreasI want to convert the video files from my Samsung phone to a more efficient format. Samsung uses x264 with a very high bitrate, instead I am using x265 with the following settings :


ffmpeg -i IN.mp4 -c:v libx265 -c:a copy -x265-params crf=25 OUT.mp4



However, there seems to be a problem with the framerate. Samsung specifies 60 fps in the metadata, but the video stream shows 29.95 fps.
If I use the above command to convert to x265, it even outputs a stream with 120 fps. ffmpeg also shows the warning "More than 1000 frames duplicated".


How can I keep the original framerate ?


Here is the ffmpeg output :


ffmpeg -i IN.mp4 -c:v libx265 -c:a copy -x265-params crf=25 OUT.mp4
ffmpeg version N-110223-gb18a9c2971-20230410 Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
 configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230410
 libavutil 58. 6.100 / 58. 6.100
 libavcodec 60. 9.100 / 60. 9.100
 libavformat 60. 4.101 / 60. 4.101
 libavdevice 60. 2.100 / 60. 2.100
 libavfilter 9. 5.100 / 9. 5.100
 libswscale 7. 2.100 / 7. 2.100
 libswresample 4. 11.100 / 4. 11.100
 libpostproc 57. 2.100 / 57. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IN.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2023-03-17T13:51:19.000000Z
 com.android.version: 13
 com.android.capture.fps: 60.000000
 Duration: 00:01:16.64, start: 0.000000, bitrate: 26864 kb/s
 Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 26603 kb/s, 29.95 fps, 120 tbr, 90k tbn (default)
 Metadata:
 creation_time : 2023-03-17T13:51:19.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
 Metadata:
 creation_time : 2023-03-17T13:51:19.000000Z
 handler_name : SoundHandle
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
 Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+95-38cf1c379
x265 [info]: build info [Windows][GCC 12.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-5 (Main tier)
x265 [info]: Thread pool created using 16 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 4 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-25.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to 'OUT.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 com.android.capture.fps: 60.000000
 com.android.version: 13
 encoder : Lavf60.4.101
 Stream #0:0(eng): Video: hevc (hev1 / 0x31766568), yuv420p(tv, bt709, progressive), 1920x1080, q=2-31, 120 fps, 15360 tbn (default)
 Metadata:
 creation_time : 2023-03-17T13:51:19.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
 encoder : Lavc60.9.100 libx265
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
 Metadata:
 creation_time : 2023-03-17T13:51:19.000000Z
 handler_name : SoundHandle
 vendor_id : [0][0][0][0]
[vost#0:0/libx265 @ 00000249776f1440] More than 1000 frames duplicated40.0kbits/s dup=991 drop=0 speed=0.484x
frame= 9197 fps= 52 q=37.0 Lsize= 32338kB time=00:01:16.61 bitrate=3457.6kbits/s dup=6902 drop=0 speed=0.43x
video:29752kB audio:2393kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.600966%
x265 [info]: frame I: 79, Avg QP:25.98 kb/s: 25459.52
x265 [info]: frame P: 2332, Avg QP:31.54 kb/s: 9763.15
x265 [info]: frame B: 6786, Avg QP:36.46 kb/s: 653.28
x265 [info]: Weighted P-Frames: Y:5.5% UV:5.3%

encoded 9197 frames in 177.98s (51.68 fps), 3176.26 kb/s, Avg QP:35.12



-
How to achieve 1x writing speed for 4K encoding in ffmpeg ?
27 avril 2023, par Anand92Is it possible to encode 4K asset in 1x writing speed ?



Below are our encoding commands and details of CPU, source assets, and encoding command output :



Encoding command



ffmpeg -i 4K_Source.mp4 -c:v libx265 -preset ultrafast
 -x265-params fps=60:profile=main:min-keyint=60:crf=19 -vf "scale=3840:2160"
 -sc_threshold 0 4K_UF_3840x2160_CRF19.mp4




Source Asset Details



Overall bit rate mode : Constant
Overall bit rate : 51.6 Mb/s
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main 10@L5.1@High
Duration : 1 min 33 s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate : 59.940 (60000/1001) FPS




CPU details



Intel(R) Xeon(R) CPU E7-8870 v3 @ 2.10GHz (144 core)




FFMPEG command output



ffmpeg version 3.2.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
 built with gcc 5.4.1 (Debian 5.4.1-5) 20170205
 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
 libavutil 55. 34.101 / 55. 34.101
 libavcodec 57. 64.101 / 57. 64.101
 libavformat 57. 56.101 / 57. 56.101
 libavdevice 57. 1.100 / 57. 1.100
 libavfilter 6. 65.100 / 6. 65.100
 libswscale 4. 2.100 / 4. 2.100
 libswresample 2. 3.100 / 2. 3.100
 libpostproc 54. 1.100 / 54. 1.100
[mpegts @ 0x3a2b600] start time for stream 1 is not set in estimate_timings_from_pts
[mpegts @ 0x3a2b600] Could not find codec parameters for stream 1 (Audio: 
aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' 
options
Input #0, mpegts, from 'Samsung_SUHD_Colorful_Food.mp4':
 Duration: 00:01:33.11, start: 1.050044, bitrate: 52076 kb/s
 Program 1
 Stream #0:0[0x101]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024), yuv420p10le(tv), 3840x2160 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k 
 tbn, 59.94 tbc
 Stream #0:1[0x102](und): Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
[libx265 @ 0x3a53d40] Unknown option: profile.
x265 [info]: HEVC encoder version 2.2+35-fe2f2dd96f8c
x265 [info]: build info [Linux][GCC 5.4.1][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main 10 profile, Level-5.1 (Main tier)
x265 [info]: Thread pool 0 using 64 threads on numa nodes 0,1,2,3
x265 [info]: Thread pool 1 using 64 threads on numa nodes 0,1,2,3
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 8 / wpp(68 rows)
x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 60 / 250 / 0 / 5.00
x265 [info]: Lookahead / bframes / badapt : 5 / 3 / 0
x265 [info]: b-pyramid / weightp / weightb : 1 / 0 / 0
x265 [info]: References / ref-limit cu / depth : 1 / off / off
x265 [info]: AQ: mode / str / qg-size / cu-tree : 1 / 0.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-19.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip rskip tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=8 deblock
Output #0, mp4, to 'Samsung_UF_3840x2160_CRF19.mp4':
 Metadata:
 encoder : Lavf57.56.101
 Stream #0:0: Video: hevc (libx265) ([35][0][0][0] / 0x0023), yuv420p10le, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 60k tbn, 59.94 tbc
 Metadata:
 encoder : Lavc57.64.101 libx265
Stream mapping:
 Stream #0:0 -> #0:0 (hevc (native) -> hevc (libx265))
Press [q] to stop, [?] for help
frame= 5581 fps= 20 q=-0.0 Lsize= 212585kB time=00:01:33.05
bitrate=18713.8kbits/s speed=0.336x
video:212514kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.033184%
x265 [info]: frame I: 23, Avg QP:24.29 kb/s: 133747.47
x265 [info]: frame P: 1401, Avg QP:26.43 kb/s: 31994.19
x265 [info]: frame B: 4157, Avg QP:29.67 kb/s: 13602.20
x265 [info]: consecutive B-frames: 1.3% 1.4% 1.5% 95.9%
encoded 5581 frames in 276.59s (20.18 fps), 18714.28 kb/s, Avg QP:28.83 




The encoding speed we get is 0.3x only. we are trying encode HEVC codec asset to HEVC codec itself with 4K resolution in 1x writing speed.



Are we missing any parameters in ffmpeg command which can tweak encoding speed ?