[Libav-user] Second frame of video stream in mp4 file is duplicate of first frame

Handida Trome htromep at gmail.com
Wed Jan 22 17:59:10 EET 2020

I am making video mp4 file from couple of jpg image files with different
sizes present as sample< number >.jpg (sample1.jpg, sample2.jpg, etc) in a
folder. I modified ffmpeg muxing.c
<https://www.ffmpeg.org/doxygen/3.4/muxing_8c_source.html> example to make
it create mp4 file from these set of jpg images(for frames) and also
modified it to create only video stream. It is able to create mp4 file with
n video frames from n different jpg image files, but mp4 file it outputs
when n=2 isn't as expected. I have tried from n=1 to n=7 so far. When n=2
mp4 file is created but I could see only first jpg image as frame in the
entire video. It appears as if first frame(first jpg image) is duplicated
and used as second frame too, as I just can't find image of second jpg
image file when I play the video. When I make video with 2 frames from 2
different jpg files, I want first frame to be first jpg image and second
frame to be second jpg image. How do I achieve that?

Number of frames in video can be set in #define STREAM_FRAME_RATE
n(n=number of frames). Link to code:

My ffmpeg configurations:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libflite --enable-libfontconfig
--enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libpulse
--enable-librubberband --enable-librsvg --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2
--enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx
--enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394
--enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r
--enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Hyper fast Audio and Video encoder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200122/ee0f652c/attachment.html>

More information about the Libav-user mailing list