Advertisement
Guest User

Untitled

a guest
Nov 19th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. Hi,
  2.  
  3. 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.
  4.  
  5. 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.
  6.  
  7. Now I found out that I can do something similar in ffpeg by using mpeg4 transport stream and following commands
  8.  
  9. CODE: SELECT ALL
  10. ffmpeg -i some_file.mp4 -c copy -bsf: h264_mp4toannexb out1.ts
  11. ffmpeg -i some_second_file.mp4 -c copy -bsf: h264_mp4toannexb out2.ts
  12. ffmpeg -i concat:"out1.ts|out2.ts" -c copy final.mp4
  13.  
  14.  
  15. But there are two major flaws in this solution:
  16. 1) Fps seems to change after merging
  17. 2) It is painfully slow using android's command line.
  18.  
  19. So my question at the moment are:
  20. 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?
  21. 2)Is it possible to perfectly match h264 codec settings in code?
  22. 3)Or maybe you have some other ideas how can I resolve this issue?
  23.  
  24.  
  25. 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