adding an mp3 audio trace into an mp4 file

922 views
Skip to first unread message

Maurizio Palesi

unread,
Dec 7, 2013, 9:32:56 AM12/7/13
to mp4parser-...@googlegroups.com
Hi,

My android application uses JCodec for generating an MP4 video. Unfortunately, JCodec does not allow the multiplexing of the video with an audio trace. Does MP4Parser allow to add an audio trace (in MP3) to an MP4 file? Looking at the previous posts, although I've found similar questions, I am still not sure whether it is possible or not.

In summary, I have an MP4 video and I would like to use MP4pareset for adding an audio trace (in MP3) to the MP4 video file. 

Thanks,

Maurizio

Sebastian Annies

unread,
Dec 7, 2013, 11:33:53 AM12/7/13
to mp4parser-...@googlegroups.com

I never tested it but Roman Elizarov provided the MP3TrackImpl class which will allow you to package MP3 files in MP4 containers.

--
You received this message because you are subscribed to the Google Groups "mp4parser-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Maurizio

unread,
Dec 7, 2013, 1:17:51 PM12/7/13
to mp4parser-...@googlegroups.com
Many thanks Sebastian for your quick reply. If it is possible for you, could you post a simple example code on how to use this feature? I think that it is a very common task adding an mp3 audio track to a video so it would be useful having an example code. What do you think?

sebastian.annies

unread,
Dec 7, 2013, 3:02:21 PM12/7/13
to mp4parser-...@googlegroups.com
Have a look at the examples.  There is at least one that adds aac together with h264. Adding mp3 works very similar. Just the class name of the track is different. 




-------- Ursprüngliche Nachricht --------
Von: Maurizio <maurizi...@gmail.com>
Datum: 07.12.2013 19:17 (GMT+01:00)
An: mp4parser-...@googlegroups.com
Betreff: Re: adding an mp3 audio trace into an mp4 file


Many thanks Sebastian for your quick reply. If it is possible for you, could you post a simple example code on how to use this feature? I think that it is a very common task adding an mp3 audio track to a video so it would be useful having an example code. What do you think?

Akhil Raj

unread,
Jan 19, 2016, 2:00:30 PM1/19/16
to mp4parser-discussion, maurizi...@gmail.com
Movie movie = new Movie();
//adding audio tracks
MP3TrackImpl mp3tracks = new MP3TrackImpl(new FileDataSourceImpl(tempdir));
movie.addTrack(mp3tracks);

if you get the error, "Expected Start Word 0x7ff"
remove the errors using mp3agic

Sebastian Annies

unread,
Jan 19, 2016, 2:51:21 PM1/19/16
to mp4parser-...@googlegroups.com, maurizi...@gmail.com

Mp3 is not supported by most players.  My advice is to use aac as audio codec.
As I don't believe that mp3 in mp4 makes any sense I don't support it. Commercial agreements can of course convince me.
Bwst Regards,
Sebastian

--
You received this message because you are subscribed to the Google Groups "mp4parser-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

Akhil Raj

unread,
Jan 20, 2016, 9:24:46 AM1/20/16
to mp4parser-discussion, maurizi...@gmail.com
MP4parser is an amazing API , it makes merging videos very simple. 
Thank you Sebastian Annies for your work !

The main reason many want to use mp3 is because ,
They are developing Android applications , people generally download mp3 music on their phones.Many mobile users aren't familiar with the other formats.
If the application needs to change the audio of a .mp4 file on the mobile, then its more likely user would be using a mp3 audio file.

I understand your concern, mp3 with mp4 isn't the best option , but as app developers  we would target a bigger audience.
To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discussion+unsub...@googlegroups.com.

Sebastian Annies

unread,
Jan 20, 2016, 1:21:03 PM1/20/16
to mp4parser-...@googlegroups.com, Maurizio Palesi
Well - if you are on 4.x you could use MediaCodec API to convert it.

2016-01-20 16:24 GMT+02:00 Akhil Raj <akhil...@gmail.com>:
MP4parser is an amazing API , it makes merging videos very simple. 
Thank you Sebastian Annies for your work !

The main reason many want to use mp3 is because ,
They are developing Android applications , people generally download mp3 music on their phones.Many mobile users aren't familiar with the other formats.
If the application needs to change the audio of a .mp4 file on the mobile, then its more likely user would be using a mp3 audio file.

I understand your concern, mp3 with mp4 isn't the best option , but as app developers  we would target a bigger audience.
  

On Saturday, December 7, 2013 at 8:02:56 PM UTC+5:30, Maurizio Palesi wrote:

--
You received this message because you are subscribed to the Google Groups "mp4parser-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discus...@googlegroups.com.

Akhil Raj

unread,
Jan 26, 2016, 3:57:50 AM1/26/16
to mp4parser-discussion, maurizi...@gmail.com
I have developed the android application that does add mp3 music to mp4. What i have experienced while testing is that , the video will not play in all the media players.
On players like VLC and MX  the video plays flawlessly but older versions of default google media player fails. i have tested with a group of people and found that about 80% of the android devices will play it but the rest will not. As a developer that's a risk I cant take. So i am gonna take your advice and convert the audio to acc format.
To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discussion+unsub...@googlegroups.com.

Sebastian Annies

unread,
Jan 26, 2016, 4:39:36 AM1/26/16
to mp4parser-...@googlegroups.com, Maurizio Palesi

That is exactly what I was talking about. There isn't much support. ...

To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mp4parser-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mp4parser-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages