Discussion:
[Libav-user] Find audio frames headers within bitstream
Vasiliy Volkov
2018-11-07 10:47:55 UTC
Permalink
Hi, again,

we've encountered an issue with decoding audio streams. Sometimes audio
codec headers are not aligned to PES packets (we work with mpegts). So when
we try to decode such streams libav decoder fails, because he can't find
where to start decoding process. For such task libav has parsers, which
need to be used for correct decoding arbitrary bitstreams: first you find
position of header, next send to decoder. We've find that there are exists
private api for such task: libavcodec/mpegaudiodecheader.h but it's
private, and using it in our project is not very clean way, and all public
API's requires to use avio* methods which we don't like to use.

Is there any other of private API way to find audio frames headers
positions?
Paul B Mahol
2018-11-07 11:07:00 UTC
Permalink
Post by Vasiliy Volkov
Hi, again,
we've encountered an issue with decoding audio streams. Sometimes audio
codec headers are not aligned to PES packets (we work with mpegts). So when
we try to decode such streams libav decoder fails, because he can't find
where to start decoding process. For such task libav has parsers, which
need to be used for correct decoding arbitrary bitstreams: first you find
position of header, next send to decoder. We've find that there are exists
private api for such task: libavcodec/mpegaudiodecheader.h but it's
private, and using it in our project is not very clean way, and all public
API's requires to use avio* methods which we don't like to use.
Is there any other of private API way to find audio frames headers
positions?
What is wrong with using parsers?
Vasiliy Volkov
2018-11-07 11:33:03 UTC
Permalink
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Hi, again,
we've encountered an issue with decoding audio streams. Sometimes audio
codec headers are not aligned to PES packets (we work with mpegts). So
when
Post by Vasiliy Volkov
we try to decode such streams libav decoder fails, because he can't find
where to start decoding process. For such task libav has parsers, which
need to be used for correct decoding arbitrary bitstreams: first you find
position of header, next send to decoder. We've find that there are
exists
Post by Vasiliy Volkov
private api for such task: libavcodec/mpegaudiodecheader.h but it's
private, and using it in our project is not very clean way, and all
public
Post by Vasiliy Volkov
API's requires to use avio* methods which we don't like to use.
Is there any other of private API way to find audio frames headers
positions?
What is wrong with using parsers?
Parsers are private api and when we compile libav they are not included,
so we need to copy header file into our project and then access -- it's not
good way.
So what is the proper way?
Post by Vasiliy Volkov
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Paul B Mahol
2018-11-07 11:38:02 UTC
Permalink
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Hi, again,
we've encountered an issue with decoding audio streams. Sometimes audio
codec headers are not aligned to PES packets (we work with mpegts). So
when
Post by Vasiliy Volkov
we try to decode such streams libav decoder fails, because he can't find
where to start decoding process. For such task libav has parsers, which
need to be used for correct decoding arbitrary bitstreams: first you find
position of header, next send to decoder. We've find that there are
exists
Post by Vasiliy Volkov
private api for such task: libavcodec/mpegaudiodecheader.h but it's
private, and using it in our project is not very clean way, and all
public
Post by Vasiliy Volkov
API's requires to use avio* methods which we don't like to use.
Is there any other of private API way to find audio frames headers
positions?
What is wrong with using parsers?
Parsers are private api and when we compile libav they are not included,
so we need to copy header file into our project and then access -- it's not
good way.
Why they are not included when you compile FFmpeg?
Post by Vasiliy Volkov
So what is the proper way?
Proper way is to have parsers included, and to have them automatically used.
Vasiliy Volkov
2018-11-07 12:09:46 UTC
Permalink
Post by Paul B Mahol
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Hi, again,
we've encountered an issue with decoding audio streams. Sometimes
audio
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
codec headers are not aligned to PES packets (we work with mpegts). So
when
Post by Vasiliy Volkov
we try to decode such streams libav decoder fails, because he can't find
where to start decoding process. For such task libav has parsers,
which
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
need to be used for correct decoding arbitrary bitstreams: first you find
position of header, next send to decoder. We've find that there are
exists
Post by Vasiliy Volkov
private api for such task: libavcodec/mpegaudiodecheader.h but it's
private, and using it in our project is not very clean way, and all
public
Post by Vasiliy Volkov
API's requires to use avio* methods which we don't like to use.
Is there any other of private API way to find audio frames headers
positions?
What is wrong with using parsers?
Parsers are private api and when we compile libav they are not included,
so we need to copy header file into our project and then access -- it's
not
Post by Vasiliy Volkov
good way.
Why they are not included when you compile FFmpeg?
Paul, ok, we've found why they are not included :) Not all headers take
into account in Makefile:
libavcodec/Makefile
HEADERS = ac3_parser.h \
adts_parser.h \
avcodec.h \
avdct.h \
avfft.h \
d3d11va.h \
dirac.h \
dv_profile.h \
dxva2.h \
jni.h \
mediacodec.h \
qsv.h \
vaapi.h \
vdpau.h \
version.h \
videotoolbox.h \
vorbis_parser.h \
xvmc.h \

And libavcodec/mpegaudiodecheader.h just not selected here.
Post by Paul B Mahol
Post by Vasiliy Volkov
So what is the proper way?
Proper way is to have parsers included, and to have them automatically used.
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Paul B Mahol
2018-11-07 12:34:24 UTC
Permalink
Post by Vasiliy Volkov
Post by Paul B Mahol
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Hi, again,
we've encountered an issue with decoding audio streams. Sometimes
audio
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
codec headers are not aligned to PES packets (we work with mpegts). So
when
Post by Vasiliy Volkov
we try to decode such streams libav decoder fails, because he can't find
where to start decoding process. For such task libav has parsers,
which
Post by Vasiliy Volkov
Post by Vasiliy Volkov
Post by Vasiliy Volkov
need to be used for correct decoding arbitrary bitstreams: first you find
position of header, next send to decoder. We've find that there are
exists
Post by Vasiliy Volkov
private api for such task: libavcodec/mpegaudiodecheader.h but it's
private, and using it in our project is not very clean way, and all
public
Post by Vasiliy Volkov
API's requires to use avio* methods which we don't like to use.
Is there any other of private API way to find audio frames headers
positions?
What is wrong with using parsers?
Parsers are private api and when we compile libav they are not included,
so we need to copy header file into our project and then access -- it's
not
Post by Vasiliy Volkov
good way.
Why they are not included when you compile FFmpeg?
Paul, ok, we've found why they are not included :) Not all headers take
libavcodec/Makefile
HEADERS = ac3_parser.h \
adts_parser.h \
avcodec.h \
avdct.h \
avfft.h \
d3d11va.h \
dirac.h \
dv_profile.h \
dxva2.h \
jni.h \
mediacodec.h \
qsv.h \
vaapi.h \
vdpau.h \
version.h \
videotoolbox.h \
vorbis_parser.h \
xvmc.h \
And libavcodec/mpegaudiodecheader.h just not selected here.
Please post configure line of your ffmpeg compilation. It is part of
ffmpeg output wihtout -hide-banner.
Nicolas George
2018-11-07 13:51:45 UTC
Permalink
Post by Vasiliy Volkov
And libavcodec/mpegaudiodecheader.h just not selected here.
That is normal. What you need to use parsers is in avcodec.h.

Regards,
--
Nicolas George
Continue reading on narkive:
Loading...