1

Hi please help me to get out of this issue. Here I writing my services in Spring. I am trying to upload a large video file onto the server. For that in android I am splitting the video into some parts(each has 1 MB) as chunks. And their local paths are as below

[ /storage/emulated/0/1493357699.mp4.001, 
/storage/emulated/0/1493357699.mp4.002, 
/storage/emulated/0/1493357699.mp4.003, 
/storage/emulated/0/1493357699.mp4.004, 
/storage/emulated/0/1493357699.mp4.005, 
/storage/emulated/0/1493357699.mp4.006, 
/storage/emulated/0/1493357699.mp4.007, 
/storage/emulated/0/1493357699.mp4.008 ]

I wrote the code at server side as below

@RequestMapping(value = "/replyToQuestionAns", method = RequestMethod.POST, headers = "content-type=multipart/*", produces = { "application/json" })
    @ResponseBody
    public StatusObject replyToQuestionAns(
                @RequestParam Map<String, String> requestParams,
                @RequestParam("file") MultipartFile[] files) throws Exception {


            return null;
}

I am getting all chunk(splitted) files but I don't know how to handle them. I tried to merge all chunked videos. But I don't know how to merge them. Please help me.

  • You maybe re-use solutions: http://stackoverflow.com/questions/26711526/streaming-large-files-with-spring-mvc and http://stackoverflow.com/questions/37870989/spring-how-to-stream-large-multipart-file-uploads-to-database-without-storing – Vy Do May 02 '17 at 11:33

1 Answers1

1

First you have to convert those all chunks of type .ts with following command

C:\\ffmpeg\\bin\\ffmpeg -i C:\\journalism\\videos\\vid1.mp4 -vcodec copy -acodec aac -vbsf h264_mp4toannexb -f mpegts C:\\journalism\\videos\\vid1.ts

later concat all those converted files with the below command

ffmpeg -i "concat:C:\\journalism\\videos\\vid1.ts|C:\\journalism\\videos\\vid2.ts" -c copy C:\\journalism\\videos\\output.mp4
basha
  • 587
  • 2
  • 6
  • 25