How to successfully use ffmpeg to convert images into videos -


currently i'm trying make 5 second videos each image , combining them using concat, i'm having lot of issues doing this.

here code:

ffmpeg -loop 1 -i 000.jpg -t 5 000.mp4 ffmpeg -loop 1 -i 001.jpg -t 5 001.mp4 ffmpeg -f concat -i inputs.txt -codec copy output.mp4

inputs.txt lists following file '000.mp4' file '001.mp4'

now when try of this, run output mp4 file , first part of works fine, once starts displaying 001 part of video, switches gray screen. doesn't in stand-alone file 001.mp4.

any suggestions on what's going on or fix this?

i've tried many other things too. switching files on png instead, gave same issue. tried using different output file types wmv, avi, etc. i'm still new though don't know else try.

this shows in command prompt after running command.

c:\xampp\htdocs\images>ffmpeg -f concat -i inputs.txt -codec copy output.mp4 ffmpeg version n-50911-g9efcfbe copyright (c) 2000-2013 ffmpeg developers   built on mar 13 2013 21:26:48 gcc 4.7.2 (gcc)   configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib   libavutil      52. 19.100 / 52. 19.100   libavcodec     55.  0.100 / 55.  0.100   libavformat    55.  0.100 / 55.  0.100   libavdevice    54.  4.100 / 54.  4.100   libavfilter     3. 45.103 /  3. 45.103   libswscale      2.  2.100 /  2.  2.100   libswresample   0. 17.102 /  0. 17.102   libpostproc    52.  2.100 / 52.  2.100 [concat @ 003b9660] estimating duration bitrate, may inaccurate input #0, concat, 'inputs.txt':   duration: 00:00:00.01, start: 0.000000, bitrate: 28 kb/s     stream #0:0: video: h264 (high 4:4:4 predictive) (avc1 / 0x31637661), yuv444 p, 800x600 [sar 1:1 dar 4:3], 28 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc output #0, mp4, 'output.mp4':   metadata:     encoder         : lavf55.0.100     stream #0:0: video: h264 ([33][0][0][0] / 0x0021), yuv444p, 800x600 [sar 1:1  dar 4:3], q=2-31, 28 kb/s, 25 fps, 12800 tbn, 12800 tbc stream mapping:   stream #0:0 -> #0:0 (copy) press [q] stop, [?] frame=  250 fps=0.0 q=-1.0 lsize=      31kb time=00:00:09.88 bitrate=  26.1kbits /s video:28kb audio:0kb subtitle:0 global headers:0kb muxing overhead 13.534948%  c:\xampp\htdocs\images> 

your console output shows writing 4:4:4 h.264 output, few players support. (newer versions of ffmpeg warn that.) add -pix_fmt yuv420p before output file convert supported 4:2:0 pixel format. additionally include -profile:v baseline make work on more players. (these options apply encoding, don't use them on command specifies -codec copy.) try playing output file ffplay, 1 of few players support 4:4:4 h.264 in mp4 files.

if want same duration each image , consecutively numbered, need single command such as:

ffmpeg -framerate 0.2 -i %3d.jpg -vf fps=10 -pix_fmt yuv420p output.mp4 

the -framerate 0.2 sets input frame rate 0.2 frames per second (1 frame every 5 seconds). %3d replaced 3 digits 000, 001, etc. each frame. -vf fps=10 change frame rate 10 frames per second, in case duplicating input frames; not strictly necessary can helpful low frame rates make seeking smoother , ensure full duration first , last images, , should not increase output size since frames identical previous frame can encoded in small size.

if want continue using concat demuxer, or want different file names or durations each image, can specify image directly duration each 1 in inputs.txt. there no need create separate movie file each image. example:

file 000.jpg duration 5 file 001.jpg duration 5 ... 

then use concat demuxer concatenate them , perform encoding @ same time:

ffmpeg -f concat -i inputs.txt -vf fps=10 -pix_fmt yuv420p output.mp4 

if of these things don't work, upgrade ffmpeg latest version.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -