[FFmpeg-user] When merging an image with audio the resulting mp4 has a black screen

gfmonk gary at gurudental.com
Tue Sep 2 20:14:56 CEST 2014


I am in the process of converting an existing application to the latest
version of ffmpeg. When I merge an jpg and wav file to create an mp4 I get a
black screen. The command line is...

ffmpeg -loop 1 -y -i image3.jpg -i audio2.wav -vf "scale=400:300" -acodec
libvo_aacenc -vcodec libx264 -shortest out.mp4

The log shows... 

C:\ffmpeg>ffmpeg -loop 1 -y -i image3.jpg -i audio2.wav -vf "scale=400:300"
-aco
dec libvo_aacenc -vcodec libx264 -shortest out.mp4
ffmpeg version N-65557-ga8592db Copyright (c) 2000-2014 the FFmpeg
developers
  built on Aug 12 2014 22:09:32 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls
--enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b
--enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-
libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54.  1.100 / 54.  1.100
  libavcodec     56.  0.100 / 56.  0.100
  libavformat    56.  0.100 / 56.  0.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.100 /  5.  0.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  0.100 /  1.  0.100
  libpostproc    53.  0.100 / 53.  0.100
[mjpeg @ 00000000042f4420]* ignoring invalid SAR: 76/75*
Input #0, image2, from 'image3.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg), 400x228, 25 fps, 25
tbr, 2
5 tbn, 25 tbc
Guessed Channel Layout for  Input Stream #1.0 : mono
Input #1, wav, from 'audio2.wav':
  Duration: 00:00:14.06, bitrate: 88 kb/s
    Stream #1:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11025 Hz, 1
channels, u8
, 88 kb/s
[swscaler @ 00000000042d00a0] deprecated pixel format used, make sure you
did se
t range correctly
No pixel format specified, yuvj444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000004310420] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2
AVX
[libx264 @ 0000000004310420] profile High 4:4:4 Predictive, level 2.1, 4:4:4
8-b
it
[libx264 @ 0000000004310420] 264 - core 142 r2453 ea0ca51 - H.264/MPEG-4 AVC
cod
ec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options:
cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=4 threads=12 lookahead_threads=2 sliced_threads=0 nr=0
deci
mate=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=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf56.0.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj444p,
400x3
00, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.0.100 libx264
    Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 11025
Hz, m
ono, s16, 128 kb/s
    Metadata:
      encoder         : Lavc56.0.100 libvo_aacenc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_u8 (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
frame=  303 fps=0.0 q=28.0 size=      39kB time=00:00:09.88 bitrate= 
32.4kbits/
frame=  406 fps=0.0 q=-1.0 Lsize=      77kB time=00:00:16.16 bitrate= 
38.8kbits
/s
video:40kB audio:28kB subtitle:0kB other streams:0kB global headers:0kB
muxing o
verhead: 13.300948%
[libx264 @ 0000000004310420] frame I:2     Avg QP:16.59  size: 15640
[libx264 @ 0000000004310420] frame P:102   Avg QP:15.44  size:    26
[libx264 @ 0000000004310420] frame B:302   Avg QP:24.34  size:    20
[libx264 @ 0000000004310420] consecutive B-frames:  0.7%  0.0%  0.7% 98.5%
[libx264 @ 0000000004310420] mb I  I16..4: 20.4% 49.4% 30.2%
[libx264 @ 0000000004310420] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.1% 
0.0
%  0.0%  0.0%  0.0%    skip:99.8%
[libx264 @ 0000000004310420] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.7% 
0.0
%  0.0%  direct: 0.0%  skip:99.3%  L0:36.2% L1:63.8% BI: 0.0%
[libx264 @ 0000000004310420] 8x8 transform intra:49.3% inter:97.1%
[libx264 @ 0000000004310420] coded y,u,v intra: 74.3% 37.5% 32.5% inter:
0.0% 0.
0% 0.0%
[libx264 @ 0000000004310420] i16 v,h,dc,p: 28% 30%  2% 41%
[libx264 @ 0000000004310420] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 33% 12%  5% 
4%
 8%  1%  5%  2%
[libx264 @ 0000000004310420] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 23%  9%  6% 
5%
12%  3%  7%  3%
[libx264 @ 0000000004310420] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000004310420] ref P L0: 83.1%  1.2% 12.0%  3.6%
[libx264 @ 0000000004310420] ref B L0: 81.4% 18.3%  0.3%
[libx264 @ 0000000004310420] ref B L1: 99.2%  0.8%
[libx264 @ 0000000004310420] kb/s:19.72

As you can see I'm getting a SAR error and I'm wondering if this is the
problem.

The net result that I'm trying to accomplish is to be able to take any size
image and merge it with a wav file and create a mp4 video.

Currently I resize the image so the both the height and width are even
numbers and then merge it with the audio. The current size of the image is
400x228.

Thanks for the help!!
Gary





--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/When-merging-an-image-with-audio-the-resulting-mp4-has-a-black-screen-tp4667118.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list