gpt4 book ai didi

FFMPEG 图片+音乐=视频

转载 作者:行者123 更新时间:2023-12-04 22:45:20 30 4
gpt4 key购买 nike

只是尝试从图像 (1080p .png) + 音乐 (320Kb mp3) 为 youtube 制作视频。

    ffmpeg -loop 1 -i image.png -i music.mp3 -c:a copy -c:v libx264 -crf 0 -preset veryslow -shortest output.mp4

但是转换很慢。任何想法,它如何进行优化?
E:_TEST>ffmpeg -loop 1 -i image0.png -i music0.mp3 -c:a aac -c:v libx264 -crf 0 -preset veryfast -shortest video0.mp4
ffmpeg version N-87306-g6743351 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 75.100 / 55. 75.100
libavcodec 57.106.101 / 57.106.101
libavformat 57. 82.100 / 57. 82.100
libavdevice 57. 8.101 / 57. 8.101
libavfilter 6.105.100 / 6.105.100
libswscale 4. 7.103 / 4. 7.103
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, png_pipe, from 'image0.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, mp3, from 'music0.mp3':
Metadata:
encoder : Lavf57.56.101
Duration: 01:00:33.06, start: 0.025057, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : Lavc57.64
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000000002d3f320] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1
[libx264 @ 0000000002d3f320] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
[libx264 @ 0000000002d3f320] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - <a href="http://www.videolan.org/x264.html" rel="noreferrer noopener nofollow">http://www.videolan.org/x264.html</a> - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=2 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=12 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, mp4, to 'video0.mp4':
Metadata:
encoder : Lavf57.82.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p(progressive), 1920x1080, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.106.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.106.101 aac
frame= 107 fps= 40 q=-1.0 Lsize= 778kB time=00:00:04.24 bitrate=1503.5kbits/s speed=1.57x



最佳答案

ffmpeg -loop 1 -framerate 1 -i image.png -i music.mp3 -c:v libx264 -crf 0 -preset veryfast -tune stillimage -c:a copy -shortest output.mkv
  • 使用帧速率 1。
  • 仅混合音频并避免重新编码音频。
  • 使用 Matroska 输出格式而不是 MP4 来处理几乎所有的音频格式。

输出可能无法在某些播放器上运行,但在 YouTube 上可以正常运行。

关于FFMPEG 图片+音乐=视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46328198/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com