I have a c++ script that coneverts a series of jpg into a .mp4 video, the command i use is the folllowing:
std::system("ffmpeg -threads auto -y -framerate 1.74659 -i /mnt/ev_ramdsk/1/%05d-capture.jpg -vcodec libx264 -preset ultrafast /mnt/ev_ramdsk/1/video.mp4");
which produces a .mp4 video file like its supposed to except it cant be played from anywhere (tested in 2 computers and html5 video)
But, if from the same computer where the program runs, i do:
ffmpeg -threads auto -y -framerate 2 -i %05d-capture.jpg -vcodec libx264 -preset ultrafast video.mp4
from the command line, the output video plays wonderfully (except in vlc, for vlc i have to use -vcodec mpeg4)
What can possibly cause this behaviour? could cp command corrupt the file? (ran after the mpeg to move it out of the ramfs)
EDIT:
As requested, i ran the whole set of commands one by one in the console exactly as the program do (the program logs every single command it runs, i just repeated them).
The commands are:
cp -r /var/cache/zoneminder/events/1/16/05/18/23/30/00/ /mnt/ev_ramdsk/1/
ffmpeg -threads auto -y -framerate 1.76729 -i /mnt/ev_ramdsk/1/%5d-capture.jpg -preset ultrafast /mnt/ev_ramdsk/1/video.mp4
cp /mnt/ev_ramdsk/1/video.mp4 /var/cache/evmanager/videos/1/2016_05_18_23_30_00_.mp4
The resulting .mp4 file can be played without any trouble. Also, is the only one with a preview image in the file explorer.
Thank you very much!
-framerate 2is not the same as-framerate 1.74659, you should try testing with the exact same command line.std::systemcalls the command processor. You also haveexecvand similar functions. You may need to call the latter instead ofsystem. See heresystembut this different command works from the command line, therefore the problem is withsystem." I'm saying try running the exact same command from the command line as the problem may be with the actual command.