Advertisement
Guest User

Untitled

a guest
Dec 10th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. I am concatenating two mp4 files by first converting them to mpeg, once I have concatenated the mpegs I want to produce a final larger mp4.
  2.  
  3. The following code works fine in order to produce the mpegs
  4.  
  5. ffmpeg -i one.mp4 -q:v 2 -vcodec mpeg2video -acodec copy one.mpg
  6.  
  7. ffmpeg -i two.mp4 -q:v 2 -vcodec mpeg2video -acodec copy two.mpg
  8.  
  9. After concatenating these 2 files (using java) I produce the final mp4 like this:
  10.  
  11. ffmpeg -i joined.mpg -vcodec libx264 -acodec copy joined.mp4
  12.  
  13. The command works and a low quality mp4 is produced since I am not specifying a 'bitrate' or 'videosize' in the MediaRecorder class object.
  14.  
  15. Here are the settings I use on my MediaRecorder object when encoding the video in Android
  16.  
  17. mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
  18. mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
  19. mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
  20. mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  21. mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
  22.  
  23. if I add the following two lines in order to increase the bitrate and videosize of one.mp4 and two.mp4 then the resultant mp4's playback fine using the default player on android, but after converting to mpg and then concatenating and then using the above ffmpeg command to encode a new mp4, the command fails.
  24.  
  25. mediaRecorder.setVideoEncodingBitRate(1599000);
  26. mediaRecorder.setVideoSize(800, 480);
  27.  
  28. Do i need to add more parameters to my ffmpeg commands in order to do this successfully?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement