Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How to combine multiple images and multiple audio files into one video with ffmpeg ?
14 mars, par nachocabI have two images
image1.png
andimage2.png
, they both have the same dimensions. I also have two audio filesaudio1.wav
andaudio2.wav
they each have different lengths. I want to make a video that showsimage1.png
duringaudio1.wav
and thenimage2.png
overaudio2.wav
.I've tried two methods, but they don't work. The images show correctly, but the durations are not synced with the audio.
Method 1: create videos separately and combine them:
image1 => video1
ffmpeg -loop 1 \ -y \ -i "image1.png" \ -i "audio1.wav" \ -c:v libx264 -tune stillimage -pix_fmt yuv420p \ -c:a aac -b:a 192k \ -shortest \ "video1.mp4" ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.38) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.2.0/include/openjpeg-2.2 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, png_pipe, from 'image1.png': Duration: N/A, bitrate: N/A Stream #0:0: Video: png, rgba(pc), 800x800, 25 fps, 25 tbr, 25 tbn, 25 tbc Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, wav, from 'audio1.wav': Metadata: title : untitled track : 1 Duration: 00:00:03.70, bitrate: 1411 kb/s Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (png (native) -> h264 (libx264)) Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0x7fead980bc00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 0x7fead980bc00] profile High, level 3.1 [libx264 @ 0x7fead980bc00] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-3:-3 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=2.00:0.70 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-4 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.20 Output #0, mp4, to 'video1.mp4': Metadata: encoder : Lavf57.71.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 800x800, q=-1--1, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc57.89.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 192 kb/s Metadata: encoder : Lavc57.89.100 aac frame= 151 fps=0.0 q=-1.0 Lsize= 106kB time=00:00:05.92 bitrate= 146.6kbits/s speed=6.73x video:13kB audio:87kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.016360% [libx264 @ 0x7fead980bc00] frame I:1 Avg QP:14.87 size: 5746 [libx264 @ 0x7fead980bc00] frame P:38 Avg QP:12.15 size: 51 [libx264 @ 0x7fead980bc00] frame B:112 Avg QP:16.81 size: 48 [libx264 @ 0x7fead980bc00] consecutive B-frames: 0.7% 1.3% 0.0% 98.0% [libx264 @ 0x7fead980bc00] mb I I16..4: 46.9% 44.7% 8.4% [libx264 @ 0x7fead980bc00] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:99.9% [libx264 @ 0x7fead980bc00] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.7% L0:63.5% L1:36.5% BI: 0.0% [libx264 @ 0x7fead980bc00] 8x8 transform intra:40.7% inter:20.0% [libx264 @ 0x7fead980bc00] coded y,uvDC,uvAC intra: 4.9% 0.0% 0.0% inter: 0.0% 0.0% 0.0% [libx264 @ 0x7fead980bc00] i16 v,h,dc,p: 82% 13% 4% 0% [libx264 @ 0x7fead980bc00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 74% 2% 24% 0% 0% 0% 0% 0% 0% [libx264 @ 0x7fead980bc00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 24% 32% 2% 2% 2% 2% 1% 2% [libx264 @ 0x7fead980bc00] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0x7fead980bc00] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x7fead980bc00] ref B L0: 48.0% 52.0% [libx264 @ 0x7fead980bc00] ref B L1: 99.5% 0.5% [libx264 @ 0x7fead980bc00] kb/s:17.36 [aac @ 0x7fead981b400] Qavg: 535.938
image2 => video2
ffmpeg -loop 1 \ -y \ -i "image2.png" \ -i "audio2.wav" \ -c:v libx264 -tune stillimage -pix_fmt yuv420p \ -c:a aac -b:a 192k \ -shortest \ "video2.mp4" ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.38) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.2.0/include/openjpeg-2.2 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, png_pipe, from 'image2.png': Duration: N/A, bitrate: N/A Stream #0:0: Video: png, rgba(pc), 800x800, 25 fps, 25 tbr, 25 tbn, 25 tbc Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, wav, from 'audio2.wav': Metadata: title : untitled track : 2 Duration: 00:00:05.49, bitrate: 1411 kb/s Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (png (native) -> h264 (libx264)) Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0x7fa0e201ce00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 0x7fa0e201ce00] profile High, level 3.1 [libx264 @ 0x7fa0e201ce00] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-3:-3 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=2.00:0.70 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-4 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.20 Output #0, mp4, to 'video2.mp4': Metadata: encoder : Lavf57.71.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 800x800, q=-1--1, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc57.89.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 192 kb/s Metadata: encoder : Lavc57.89.100 aac frame= 195 fps=177 q=-1.0 Lsize= 150kB time=00:00:07.68 bitrate= 160.2kbits/s speed=6.96x video:14kB audio:129kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.516541% [libx264 @ 0x7fa0e201ce00] frame I:1 Avg QP: 9.03 size: 6402 [libx264 @ 0x7fa0e201ce00] frame P:49 Avg QP: 6.59 size: 41 [libx264 @ 0x7fa0e201ce00] frame B:145 Avg QP: 9.67 size: 39 [libx264 @ 0x7fa0e201ce00] consecutive B-frames: 0.5% 1.0% 0.0% 98.5% [libx264 @ 0x7fa0e201ce00] mb I I16..4: 54.7% 36.0% 9.3% [libx264 @ 0x7fa0e201ce00] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0% [libx264 @ 0x7fa0e201ce00] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.8% L0:70.1% L1:29.9% BI: 0.0% [libx264 @ 0x7fa0e201ce00] 8x8 transform intra:36.0% inter:14.3% [libx264 @ 0x7fa0e201ce00] coded y,uvDC,uvAC intra: 4.3% 0.0% 0.0% inter: 0.0% 0.0% 0.0% [libx264 @ 0x7fa0e201ce00] i16 v,h,dc,p: 91% 5% 4% 0% [libx264 @ 0x7fa0e201ce00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 72% 8% 20% 0% 0% 0% 0% 0% 0% [libx264 @ 0x7fa0e201ce00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 23% 25% 4% 3% 3% 3% 2% 2% [libx264 @ 0x7fa0e201ce00] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0x7fa0e201ce00] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x7fa0e201ce00] ref P L0: 83.3% 8.3% 8.3% [libx264 @ 0x7fa0e201ce00] ref B L0: 40.1% 59.9% [libx264 @ 0x7fa0e201ce00] kb/s:14.38 [aac @ 0x7fa0e201e600] Qavg: 595.040
When I import these into Final Cut I can see that both videos get around 2:30 seconds of added silence (not present in the audio):
concatenating video1 and video2
ffmpeg -i "video1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts ffmpeg -i "video2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc "video_combined.mp4" ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.38) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.2.0/include/openjpeg-2.2 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.71.100 Duration: 00:00:06.04, start: 0.000000, bitrate: 143 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x800, 18 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: handler_name : SoundHandler Output #0, mpegts, to 'intermediate1.ts': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.71.100 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x800, q=2-31, 18 kb/s, 25 fps, 25 tbr, 90k tbn, 12800 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 151 fps=0.0 q=-1.0 Lsize= 135kB time=00:00:05.92 bitrate= 187.5kbits/s speed=2.43e+03x video:14kB audio:87kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 34.259724% ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.38) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.2.0/include/openjpeg-2.2 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video2.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.71.100 Duration: 00:00:07.80, start: 0.000000, bitrate: 157 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x800, 15 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: handler_name : SoundHandler Output #0, mpegts, to 'intermediate2.ts': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.71.100 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x800, q=2-31, 15 kb/s, 25 fps, 25 tbr, 90k tbn, 12800 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 195 fps=0.0 q=-1.0 Lsize= 192kB time=00:00:07.68 bitrate= 204.8kbits/s speed=2.6e+03x video:14kB audio:129kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 33.605099% ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.38) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.2.0/include/openjpeg-2.2 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, mpegts, from 'concat:intermediate1.ts|intermediate2.ts': Duration: 00:00:07.82, start: 1.456778, bitrate: 342 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 800x800, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 169 kb/s Output #0, mp4, to 'video_combined.mp4': Metadata: encoder : Lavf57.71.100 Stream #0:0: Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p(progressive), 800x800, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 169 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 346 fps=0.0 q=-1.0 Lsize= 257kB time=00:00:13.74 bitrate= 153.3kbits/s speed=1.54e+03x video:30kB audio:217kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 4.243830%
The output of the combined video contains the extra silences, but the second audio doesn't combine properly:
Method 2: Create combined video directly
ffmpeg -f concat -i input.txt -map 0 \ -vcodec libx264 \ -aprofile aac_low -acodec aac -strict experimental -cutoff 15000 -b:a 32k "video_combined.mp4"
Any ideas?
-
ffmpeg + docker : make install not installing libx265 when building the image, but works inside container
14 mars, par Alexander SantosI have this
Dockerfile
FROM ubuntu:22.04 WORKDIR /usr/local/src ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig RUN apt update && apt install -y \ build-essential cmake git pkg-config \ libxml2-dev yasm nasm libtool autoconf automake \ libx264-dev libx265-dev libnuma-dev libvpx-dev \ libfdk-aac-dev libmp3lame-dev libopus-dev \ libass-dev libfreetype6-dev libvorbis-dev RUN apt-get install libx265-dev RUN git clone --depth 1 https://github.com/fraunhoferhhi/vvenc.git && \ cd vvenc && \ mkdir build && cd build && \ cmake .. -DCMAKE_BUILD_TYPE=Release && \ make -j$(nproc) RUN cd vvenc && \ make install install-prefix=/usr/local RUN git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg RUN cd ffmpeg && \ ./configure --enable-libx265 --enable-gpl --enable-nonfree --enable-pthreads --enable-pic --enable-shared \ --enable-rpath --enable-demuxer=dash \ --enable-libxml2 --enable-libvvenc --extra-libs=-lpthread && \ make -j$(nproc) RUN cd ffmpeg && make install RUN rm -rf /var/lib/apt/lists/* # Some other irrelevant commands
It works for
VVenC
. As for works, i mean that i can enter the container with/bin/bash
, executeffmpeg -codecs | grep vvc
and this is the response:DEV.L. vvc H.266 / VVC (Versatile Video Coding) (encoders: libvvenc)
But for libx265 it's not working.
ffmpeg -codecs | grep x265 In another try: ffmpeg -codecs | grep 265 DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m) (encoders: hevc_v4l2m2m)
After i enter the ffmpeg directory again and execute
make install
it works.root@0a2ad1086abd:/usr/local/src# cd ffmpeg root@0a2ad1086abd:/usr/local/src/ffmpeg# make install ... installation logs ... root@0a2ad1086abd:/usr/local/src/ffmpeg# ffmpeg -codecs | grep x265 DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m) (encoders: libx265 hevc_v4l2m2m)
Is there anything i can do here? I tried separating layers, unifying... I really don't know what else should i do.
-
How can I crop and encode a video using flutter natively, now that flutter_ffmpeg is discontinued with no alternatives ? [closed]
13 mars, par Rageh AzzazyAs of January 6, 2025, FFmpegKit is officially retired (Taner's article).
This also affects the
flutter_ffmpeg
andffmpeg_kit_flutter
packages.Most packages for executing video editing commands were built depending on them and so won't work after April 1, 2025 as mentioned in the package documentation and Taner's article. Some packages that depend on
flutter_ffmpeg
orffmpeg_kit_flutter
are:video_trimmer
zero_video_trimmer
flutter_video_trimmer
video_trim
bemeli_compress
video_trimmer_pro
- ... others
Editing video using
video_editor
orvideo_editor_2
orvideo_editor_pits
has become a problem.I believe downloading the binaries and doing the whole thing locally is not just tedious but illegal as well.
I broke down exactly what I need to edit videos in my flutter app and I found those package but have not yet tested them.
✅ Trimming:
flutter_native_video_trimmer
✅ Compression:
video_compress
orvideo_compress_plus
✅ Muting:
video_compress
handles this❌ Encoding: Not sure, I just need a simple MP4 video files
❌ Cropping: I can't find a solution for video cropping
I don't need to rotate, reverse or do any fancy stuff to the videos, just those five functions.
Now the only way forward is to find a simple video cropping function and an encoder that work on flutter IOS & Android
My question is not looking for external library recommendations but:
Do you have any ideas how to crop a video in flutter natively?
-
How can I use physical computer's GPU on VMware Workstation ?
13 mars, par chingI want to use the GPU to accelerate video transcoding time by using FFmpeg on the virtual machine, VMware Workstation.
When I use the command
lspci | grep VGA
, the output is00:0f.0 VGA compatible controller: VMware SVGA II Adapter
It seems that I only can use its own Graphic Card on VMware, right?
How can I use my host computer's GPU, NVIDIA Quadro K2000, from a program running in a guest VM?
Or is there another solution that can solve the problem mentioned in the title?
-
Convert video MP4 audio to MP3 using C#
13 mars, par Tom LeeI have some videos in MP4 format and I'm trying to extract the audio from them.
My code is:
public static void Converter(string toConvert) { toConvert = VideoFile + ".mp4"; var join = VideoFile.Split("-").ToList(); VideoFile = string.Format("{0} - {1}", join[0], join[1]); var outputFile = VideoFile + ".mp3"; var mp3Out = ""; var ffmpegProcess = new Process { StartInfo = { UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, FileName = Directory, Arguments = " -i " + toConvert + " -vn -f mp3 -ab 320k output " + outputFile } }; ffmpegProcess.Start(); ffmpegProcess.StandardOutput.ReadToEnd(); mp3Out = ffmpegProcess.StandardError.ReadToEnd(); ffmpegProcess.WaitForExit(); if (!ffmpegProcess.HasExited) { ffmpegProcess.Kill(); } Console.WriteLine(mp3Out); }
However, I get this error message:
System.ComponentModel.Win32Exception: 'Access is denied'
Any Ideas?