0

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

1 Answers1

0

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:

ffmpeg -i small.mp4 -acodec aac -ab 192k -vcodec libx264 -vb 1024k -f mp4 output.mp4

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.

Business Tomcat
  • 1,021
  • 9
  • 12
  • Hi Uwe! thanks for reply, i upload the videos, the error arrive between videos concatenation process, and after this, it wait and jump over the maximum time range possible by video1 + video2, it work.. the first video after minutes of pause happen the second video with a strange wrong fps effect. This is the link that you can download my video test, i can't understand what i need more to video conformance to concat, I'm not sure about audio encoding, Thanks a lot for your time – Massimo Vantaggio Jan 24 '18 at 21:06
  • the other message between videos concat is "[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8ef505de00] Auto-inserting h264_mp4toannexb bitstream filter" – Massimo Vantaggio Jan 24 '18 at 22:44
  • Tested your videos and also no luck :( Your videos seems to have a problem. Can't successfully concat them via concat protocol. But there is also the possibility to use concat video filter. Use this command: `ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' output.mp4` (solution taken from here https://stackoverflow.com/a/11175851/6472702). This will reencode the videos. If you want to concat more then two files, e.g. 3 files, you have to add `-i 3.mp4`, edit filter_complex and concat=n=3. See the other StackOverflow answer. – Business Tomcat Jan 25 '18 at 16:34