image - ffmpeg:从 .mp3 和 .jpg 创建 .mp4

标签 image ffmpeg mp3

我一直在寻找最好的方法来做到这一点,但似乎没有任何效果。我正在使用 Ubuntu 20.04。
ffmpeg 版本:

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100


这是我正在使用的命令:
ffmpeg -y -hide_banner -loop 1 -i test.jpg -i test.mp3 -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4
结果不会在 VLC 中播放。该命令需要很长时间才能完成。 test.jpg 图像的 y 维度也是奇数,所以我通过将该大小减小 1 来使其与 imagick 相同。
你如何“正确”地做到这一点?

最佳答案

首先,将图像转换为正确的像素格式,最好是 png:

ffmpeg -y -i test.jpg -qmin 1 -qmax 1 -preset slow test.png
最后,从 png 图像和 mp3 创建视频:
ffmpeg -y -loop 1 -i test.png -i music.mp3 -shortest -c:v libx264 -pix_fmt yuv420p -b:v 5M -preset slow video.mp4

关于image - ffmpeg:从 .mp3 和 .jpg 创建 .mp4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68153115/

相关文章:

audio - 使用 FFMPEG 一起检测没有音频的场景变化

ffmpeg - 流式传输视频时是否真正连接字幕(HLS,M3U8)

python - 什么是用于在 Python 中验证文件的好音频库?

javascript - 在 Google AppMaker 中播放 .mp3 或 .gif 文件

将 (ID3) 标签从 FLAC 传输到 MP3 的 Linux 脚本

html - 如何在调整窗口大小时(移动 View )将此 div 居中以将它们保持在堆叠位置

c# - Excel根据图像大小调整单元格大小

JavaFX-8 FileChooser Image(后端复制粘贴)

python - 如何在pygame中绘制图像和 Sprite ?

ffmpeg - 以编程方式进行 HLS 直播