i try to write an .sh that read a folder create a playlist of mp4 files and then generate an only big video with a sequence of all videos find in the folder, and encode it for dash:
printf "file '%s'\n" ./*.mp4 > playlist.sh
ffmpeg -f concat -safe 0 -i playlist.sh -c copy concat.mp4
Till now i follow the demux concat official guido to ffmpeg website. Without result, also the following give me "more than 1000 frames duplicated between videos of the sequence"
ffmpeg -f concat -i playlist.sh -c:a aac -b:a 384k -ar 48000 -ac 2 -c:v libx264 -x264opts 'keyint=50:min-keyint=50:no-scenecut' -r 25 -b:v 2400k -maxrate 2400k -bufsize 1200k -vf "scale=-1:432 " out.mp4
Thanks a lot
Sry, cannot comment (yet)...
Your commands are correct, I could just concat some sample videos. Do you always get the mentioned error, or also something else? And is the video working, or no video is created? In most cases, the input video is incorrect. Wrong input format (not fitting to file extension) or worse like ending at wrong frame. Perhaps you can make the video available?
PS: Needed to add
-safe 0
to the second command to avoid error[concat @ 0x7fbfd1000000] Unsafe file name './small.mp4'
Hint: Do not use file extension
.sh
for your list of video files. This extension is used for shell scripts, so it can be confusing. Just use.txt
.UPDATE @Massimo Vantaggio
We should not create new answers, but I cannot comment yours and I also don't know how to continue our discussion, so I edit my answer.
Your videos don't look very different. Can't see, what's wrong with the first one.
Perhaps you could use
ffprobe -report input.mp4
to get more informations. Look for errors or warnings.My assumption is still that the video was cut in a hard way (by conversion software), so keyframes are messed up or something else.
You can also try to first reencode your video with ffmpeg. After that, it should be complete compatible with ffmpeg ;)
Something like this:
Use
-ab
and-vb
from your input video, or at least the bitrate from input. Quality will decrease a little bit and file size increase, but it should be okay.i change the second video with one another and its work,
This is the info of the video that corrupt the process:
Below the info of the video that work, can you help me to understand the differences?
thanks a lot!