flutter FFMPEG concat not working properly with camera recorded clips

70 views Asked by At

I am using the Flutter camera package to record videos, I record multiple videos and then concatenate them using this command:

"-y -f concat -i $videosPathsTextFilePath -c:a aac -c:v copy $fullVideoOutPath",

videosPathsTextFilePath content is:
file 'record-1709022968582.mp4'
file 'record-1709022976601.mp4'

when I record with one side only like the camera back side and concatenating the clips, it works as expected, but when I change the camera side and then concat the clips, the clip recorded after changing the camera side is shown rotated upside down as -90

I checked the clips from Device Explorer, it is all right, but after the concatenation it shows flipped.

here are the two videos before concatenation:

https://imgur.com/a/MVkEDm3
https://imgur.com/Kit1J8V

and this is the video after concatenating:
https://imgur.com/6CAxN05

Thank you in advance.

I tried to check if the user changed the camera side to track the clips recorded by this side then rotate them and move them to another directory but this command is not working

-noautorotate -display_rotation 90 -i ${videoFile.path} -c:v copy ${destinationPath}

1

There are 1 answers

0
ibrahim Eltayfe On

This solution worked for me, I re-encoded the clips so they all use the same codec.

'-y -i ${videoFile.path} -c:a aac -c:v h264 ${destinationPath}',

and then the concat worked fine with me:

-y -f concat -i $videosPathsTextFilePath -c:a aac -c:v copy $fullVideoOutPath

I do not know if this is the best approach, if you have any better solution, kindly share it.