linux 安装好ffmpeg 后输入以下命令 得到的foo.mp4文件为空 大神解答下改怎么写
ffmpeg -threads 2 -y -r 10 -i /data/test.mp3 -f image2 -framerate 12 -i /data/audio.png /data/foo.mp4
以下是linux 显示的
[root@S172-16-10-161 ffmpeg]# ffmpeg -threads 2 -y -r 10 -i /data/test.mp3 -f image2 -framerate 12 -i /data/audio.png /data/foo.mp4
ffmpeg version 4.4.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[mp3 @ 0x5fc0ec0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/data/test.mp3':
Duration: 00:00:01.98, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 16000 Hz, mono, fltp, 128 kb/s
Input #1, image2, from '/data/audio.png':
Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 128x128, 12 fps, 12 tbr, 12 tbn, 12 tbc
Stream mapping:
Stream #1:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x5fd9c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x5fd9c40] profile High 4:4:4 Predictive, level 1.0, 4:4:4, 8-bit
[libx264 @ 0x5fd9c40] 264 - core 164 r3075 66a5bc1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - 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=4 threads=4 lookahead_threads=1 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=12 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.00
Output #0, mp4, to '/data/foo.mp4':
Metadata:
encoder : Lavf58.76.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 128x128, q=2-31, 12 fps, 12288 tbn
Metadata:
encoder : Lavc58.134.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 69 kb/s
Metadata:
encoder : Lavc58.134.100 aac
frame= 1 fps=0.0 q=26.0 Lsize= 18kB time=00:00:01.92 bitrate= 75.0kbits/s speed=37.5x
video:2kB audio:15kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.332848%
[libx264 @ 0x5fd9c40] frame I:1 Avg QP:27.20 size: 858
[libx264 @ 0x5fd9c40] mb I I16..4: 21.9% 29.7% 48.4%
[libx264 @ 0x5fd9c40] 8x8 transform intra:29.7%
[libx264 @ 0x5fd9c40] coded y,u,v intra: 28.9% 5.5% 2.3%
[libx264 @ 0x5fd9c40] i16 v,h,dc,p: 36% 57% 7% 0%
[libx264 @ 0x5fd9c40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 22% 55% 0% 0% 0% 0% 0% 0%
[libx264 @ 0x5fd9c40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 24% 22% 3% 2% 1% 7% 2% 5%
[libx264 @ 0x5fd9c40] kb/s:82.37
[aac @ 0x5fef500] Qavg: 45983.758
[root@S172-16-10-161 ffmpeg]#
应该没有什么问题,可以正常输出啊,除非你源文件
test.mp3
或者audio.png
虽然存在,但数据内容为空不能生成正确的mp4.从你给出的信息输出来看,也不存在这样的问题啊,你的mp3有差不多2秒,png是128x128的分辨率。这样也不会输出为空啊。