Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: support of MOV container #20

Open
petrokarashchenko opened this issue Mar 31, 2020 · 5 comments
Open

Question: support of MOV container #20

petrokarashchenko opened this issue Mar 31, 2020 · 5 comments

Comments

@petrokarashchenko
Copy link

I have an issue when I need to save H264 video + G711 audio into container. I have read that it is not possible with mp4, but is supported by mov.
I want to ask maybe it is possible to extend this project or create a new one for support of mov container.

@lieff
Copy link
Owner

lieff commented Mar 31, 2020

Hi :)
mov and mp4 should be pretty much the same.There only different standards and atom/box layouts.
If codec do not need any specific atoms, no modification required.
Just create new track:

    MP4E_track_t tr;
    tr.track_media_kind = e_audio;
    tr.language[0] = 'u';
    tr.language[1] = 'n';
    tr.language[2] = 'd';
    tr.language[3] = 0;
    tr.object_type_indication = MP4_OBJECT_TYPE_AUDIO_ISO_IEC_14496_3;
    tr.time_scale = 90000;
    tr.default_duration = 0;
    tr.u.a.channelcount = 1;
    int audio_track_id = MP4E_add_track(mux, &tr);

All we need - specify different codec instead of MP4_OBJECT_TYPE_AUDIO_ISO_IEC_14496_3.
According to this https://github.com/ireader/media-server/blob/master/libmov/include/mov-format.h list, it should be

#define MOV_OBJECT_G711a	0xFD // ITU G.711 alaw
#define MOV_OBJECT_G711u	0xFE // ITU G.711 ulaw

Do not know if it's standard values or not though.

@petrokarashchenko
Copy link
Author

Thank you @lieff! I will try it out. Also with setting of tr.object_type_indication to MOV_OBJECT_G711u I think I will need to set tr.time_scale to 8000, because G711 use 8kHz sample rate. What do you think?

@lieff
Copy link
Owner

lieff commented Apr 1, 2020

Time scale can be any value, it's just affects timestamps which passed to MP4E_put_sample().

@rhrytsa
Copy link

rhrytsa commented Apr 1, 2020

Hi @lieff, do you know if it is enough just to change the tr.object_type_indication? Can we use G.711 packed into the 'mp4a' atom type? If I understand correctly it requires the AAC audio format, and currently, this is the only one supported in your library?

@lieff
Copy link
Owner

lieff commented Apr 1, 2020

Currently I do not know, that's why I write "If codec do not need any specific atoms". It may require another atom inside BOX_stsd. If you have sample stream - I can take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants