Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi,
- My goal is to merge two .mp4 files. BUT, there are 2 types of files. One is made by android phone's camera and the second one is encoded by me using libav.
- So at first I was trying to match the codecs of both files by sampling the first one and copying most of the settings from one AVCodecContext to the other. And by that I managed to encode photo into 100frames long video with similar codec settings. But the problem was that I was never able to match the codecs perfectly, so when I tried to merge them by simply rewriting AVPackets it failed.
- Now I found out that I can do something similar in ffpeg by using mpeg4 transport stream and following commands
- CODE: SELECT ALL
- ffmpeg -i some_file.mp4 -c copy -bsf: h264_mp4toannexb out1.ts
- ffmpeg -i some_second_file.mp4 -c copy -bsf: h264_mp4toannexb out2.ts
- ffmpeg -i concat:"out1.ts|out2.ts" -c copy final.mp4
- But there are two major flaws in this solution:
- 1) Fps seems to change after merging
- 2) It is painfully slow using android's command line.
- So my question at the moment are:
- 1)Is it possible to merge two h264 videos with slightly different codec settings into one without reencoding and without putting my streams into .ts files?
- 2)Is it possible to perfectly match h264 codec settings in code?
- 3)Or maybe you have some other ideas how can I resolve this issue?
- Sorry for no command-line ouput but as I said I am using ffmpeg as a library not a binary, so there is no ouput
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement