Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

To make the story short, I just want to create a video from a X number of images and a mp3 file, AND get the same audio quality.

I've checked the ffmpeg website, but ... here is what I've got:

ffmpeg.exe -y -i img%01d.jpg -i "03 eminem - when I'm Gone.mp3" -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest shortt.mp4

Where: In the same folder I have img0.jpg img1.jpg and so on ...

The mp3 file is the audio file.

The output should be stored in shortt.mp4

After I've runned this command, it took like 2 seconds to complete and this is the result:

C:\Users\icebox\Desktop>ffmpeg.exe -y -i img%01d.jpg -i "03 eminem - when I'm Go
ne.mp3" -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest shortt.mp
4
ffmpeg version N-57821-g1fb3b49 Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov  2 2013 18:01:35 with gcc 4.8.2 (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-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 49.100 / 52. 49.100
  libavcodec     55. 40.101 / 55. 40.101
  libavformat    55. 21.100 / 55. 21.100
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from 'img%01d.jpg':
  Duration: 00:00:00.16, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj444p(pc), 126x126 [SAR 29:22 DAR 29:22], 25 f
ps, 25 tbr, 25 tbn, 25 tbc
[mp3 @ 028dca60] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '03 eminem - when I'm Gone.mp3':
  Metadata:
    title           : When I'm Gone
    artist          : Eminem
    genre           : Other
  Duration: 00:04:40.54, start: 0.000000, bitrate: 128 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
No pixel format specified, yuvj444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 02531860] using SAR=29/22
[libx264 @ 02531860] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 02531860] profile High 4:4:4 Predictive, level 1.1, 4:4:4 8-bit
[libx264 @ 02531860] 264 - core 140 r2377 1ca7bb9 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=4 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 in
terlaced=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 scenecu
t=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 'shortt.mp4':
  Metadata:
    encoder         : Lavf55.21.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj444p, 126x1
26 [SAR 29:22 DAR 29:22], q=-1--1, 12800 tbn, 25 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 19
2 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> libx264)
  Stream #1:0 -> #0:1 (mp3 -> aac)
Press [q] to stop, [?] for help
Input stream #0:0 frame changed from size:126x126 fmt:yuvj444p to size:1024x768
fmt:yuvj444p
[swscaler @ 06562000] deprecated pixel format used, make sure you did set range
correctly
Input stream #0:0 frame changed from size:1024x768 fmt:yuvj444p to size:96x96 fm
t:yuvj420p
[swscaler @ 0257f640] deprecated pixel format used, make sure you did set range
correctly
Input stream #0:0 frame changed from size:96x96 fmt:yuvj420p to size:1920x1200 f
mt:yuvj420p
[swscaler @ 06562000] deprecated pixel format used, make sure you did set range
correctly
frame=    4 fps=0.0 q=-1.0 Lsize=       9kB time=00:00:00.16 bitrate= 456.7kbits
/s
video:8kB audio:0kB subtitle:0 global headers:0kB muxing overhead 17.815873%
[libx264 @ 02531860] frame I:1     Avg QP:32.77  size:  2030
[libx264 @ 02531860] frame P:3     Avg QP:31.02  size:  1673
[libx264 @ 02531860] mb I  I16..4:  1.6% 98.4%  0.0%
[libx264 @ 02531860] mb P  I16..4:  9.4% 40.1% 50.5%  P16..4:  0.0%  0.0%  0.0%
 0.0%  0.0%    skip: 0.0%
[libx264 @ 02531860] 8x8 transform intra:54.7%
[libx264 @ 02531860] coded y,u,v intra: 77.0% 31.8% 35.5%
[libx264 @ 02531860] i16 v,h,dc,p:  0% 26% 11% 63%
[libx264 @ 02531860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 22% 18%  9%  5%  6%  7%
 7%  8%
[libx264 @ 02531860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 12% 14%  6%  6% 10%  6%
10%  5%
[libx264 @ 02531860] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 02531860] kb/s:352.45

The file is there, but if I open it in VLC nothing happens.

I've tried it without the -shortest argument. I've waited like 5 mins to finish, still it didn't finished so I stopped it.

This is what I got:

[swscaler @ 0653e000] deprecated pixel format used, make sure you did set range correctly Any suggestions ?

PS: I also managed to create the video with a image and the audio file, but it's not looping through all the images.

Respond to first answer:

Output:

  built on Nov  2 2013 18:01:35 with gcc 4.8.2 (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-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 49.100 / 52. 49.100
  libavcodec     55. 40.101 / 55. 40.101
  libavformat    55. 21.100 / 55. 21.100
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from 'img%01d.jpg':
  Duration: 00:00:00.16, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj444p(pc), 126x126 [SAR 29:22 DAR 29:22], 25 f
ps, 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0259cac0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '03 eminem - when I'm Gone.mp3':
  Metadata:
    album_artist    : Lil Wayne
    genre           : Other
    title           : Prom Queen
    album           : Rebirth
    artist          : Lil Wayne
  Duration: 00:03:41.94, start: 0.000000, bitrate: 320 kb/s
    Stream #1:0: Audio: mp3, 48000 Hz, stereo, s16p, 320 kb/s
File 'o.mp4' already exists. Overwrite ? [y/N] y
[swscaler @ 02596ce0] deprecated pixel format used, make sure you did set range
correctly
[libx264 @ 03fd18c0] using SAR=29/22
[libx264 @ 03fd18c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 03fd18c0] profile High, level 1.1
[libx264 @ 03fd18c0] 264 - core 140 r2377 1ca7bb9 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=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 scenec
ut=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 'o.mp4':
  Metadata:
    encoder         : Lavf55.21.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 126x12
6 [SAR 29:22 DAR 29:22], q=-1--1, 12800 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (i[0][0][0] / 0x0069), 48000 Hz, stereo, 320 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> libx264)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
Input stream #0:0 frame changed from size:126x126 fmt:yuvj444p to size:1024x768
fmt:yuvj444p
[swscaler @ 051b7b20] deprecated pixel format used, make sure you did set range
correctly
Input stream #0:0 frame changed from size:1024x768 fmt:yuvj444p to size:96x96 fm
t:yuvj420p
[swscaler @ 051b7b20] deprecated pixel format used, make sure you did set range
correctly
Input stream #0:0 frame changed from size:96x96 fmt:yuvj420p to size:1920x1200 f
mt:yuvj420p
[swscaler @ 05173fa0] deprecated pixel format used, make sure you did set range
correctly
frame=    4 fps=0.0 q=-1.0 Lsize=      15kB time=00:00:00.16 bitrate= 718.6kbits
/s
video:7kB audio:7kB subtitle:0 global headers:0kB muxing overhead 9.792652%
[libx264 @ 03fd18c0] frame I:1     Avg QP:31.89  size:  1831
[libx264 @ 03fd18c0] frame P:3     Avg QP:30.50  size:  1487
[libx264 @ 03fd18c0] mb I  I16..4:  3.1% 90.6%  6.3%
[libx264 @ 03fd18c0] mb P  I16..4:  7.8% 41.1% 51.0%  P16..4:  0.0%  0.0%  0.0%
 0.0%  0.0%    skip: 0.0%
[libx264 @ 03fd18c0] 8x8 transform intra:53.5%
[libx264 @ 03fd18c0] coded y,uvDC,uvAC intra: 76.2% 66.0% 37.5%
[libx264 @ 03fd18c0] i16 v,h,dc,p: 18% 12%  6% 65%
[libx264 @ 03fd18c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 21% 22%  9%  6%  8%  6%
 7%  9%
[libx264 @ 03fd18c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 11% 15%  7%  6% 11%  6%
10%  5%
[libx264 @ 03fd18c0] i8c dc,h,v,p: 64% 16% 17%  3%
[libx264 @ 03fd18c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 03fd18c0] kb/s:314.65

The output video has only 12 KB, and when I open it with VLC nothing happens, no sound, no video.

share|improve this question
    
Might I ask why not use Windows Movie Maker or similar software? –  Doktoro Reichard Nov 3 '13 at 18:01
    
I need a command line tool :) –  icebox19 Nov 3 '13 at 19:04

1 Answer 1

Chroma subsampling

From your console output:

No pixel format specified, yuvj444p for H.264 encoding chosen.  
Use -pix_fmt yuv420p for compatibility with outdated media players.

Meaning you need to add -pix_fmt yuv420p as an output option. Otherwise ffmpeg may (depending on your inputs, ffmpeg version, and the encoder being used) try to avoid chroma subsampling. Technically this is good, but most (all?) non-FFmpeg based players such as QuickTime will not decode it properly.

Changing frame sizes

From your console output:

Input stream #0:0 frame changed from size:126x126 fmt:yuvj444p to
size:1024x768 fmt:yuvj444p

This is telling you that your input frames are not all of the same size and may cause unexpected behavior.

[swscaler @ 0257f640] deprecated pixel format used, make sure you did set range correctly

This is a warning (more for developers than users) that you can ignore.

Audio

You are re-encoding the audio. Instead you can stream copy the audio since your output container (mp4) should support MP3 audio. This will avoid re-encoding and therefore preserve the quality and will also work much faster.

Example

ffmpeg -i img%01d.jpg -i "03 eminem - when I'm Gone.mp3" -c:v libx264 \
-pix_fmt yuv420p -c:a copy -shortest output.mp4
share|improve this answer
    
I've edited the post. –  icebox19 Nov 3 '13 at 19:09
    
@icebox19 But you didn't include your ffmpeg command or say what the remaining issues are. –  LordNeckbeard Nov 3 '13 at 23:50
    
I've edited the post again. –  icebox19 Nov 4 '13 at 12:11
    
@icebox19 Your images vary in frame size: 96x96, 126x126, 1024x768, and 1920x1200. You need to make sure all of your input images are the same frame size. –  LordNeckbeard Nov 4 '13 at 21:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.