I am having to reference MPEG-2 code. My application needs analyze I-frames. Looking at the code I am unable to figure out how exactly this can be done.
Basically I want to extract the first or second I-frame. How do I do that and where do I find the information regarding the frame type?
I would appreciate any direction on this.
I Just wrote this answer: Can you find key frame (I-frame) in h264 video without decoding? i.e. is it in packet?
which applies to you just as well.
The start code of picture in MPEG2 is 0x00 .
Further, you can see byte 5 - to identify the picture type.
See here: http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html
Related
I am experimenting with a custom implementation of a "Correlate Access Code Tag" block and I am getting a "Missing a required length tag on port 0 at item #0" when I connect its output to a "Repack Bits" or to a "Tagged Stream to PDU".
Bitstream -> Correlate Access Code Tag -> Repack Bits -> Tagged Stream
to PDU
My idea was to examine a stream of bits until I find the access code. Then, read the following bits to get the length of the packet. Finally, knowing the length of the packet I thought I could just add a tag as "packet_length: x ", so that the following blocks understood that they have to pack the next x bits after the tag as a pdu.
However, taking a look at the error I get and reading a little bit, I think I am misunderstanding how to use the tags. So I wanted to ask whether the tagged stream I am producing (with tags at irregular and arbitrary intervals, whenever I find the access code) is really a tagged stream.
My other idea is that maybe the error is in the fact that my "Correlate Access Code Tag" block is outputing samples no matter if they have a tag or not. In that case, some samples without tags are going to reach the blocks that expect tagged streams before one tag arrives. Should I just start outputting samples after I find the access code and therefore make sure that the first sample always has a tag?. If so, wouldn't it be easy to just keep reading bits and build the pdu inside the "Correlate Access Code Tag" block directly?. Also, am I correct if I say that it makes no sense to solve variable length tasks with tags?
If you think that none of the options that I mentioned (tagged streams vs build the pdu within the access code block) are suitable for this variable length task, I would appreciate if you could point me in the right direction.
I am sorry for the noob questions, but I am a little bit stuck with this.
Thanks in advance :)
I've been reading the documentation but it's a little tough to see how to set up a pipeline in C++ using the UDP source element.
If anyone knows of an example, or could post a snippet showing how to do it, I'd be very grateful.
Is it enough to do
source = gst_element_make_from_uri(GST_URI_SRC, "udp://#:15004", "source");
and then use the result as the first element in a pipeline?
User otopolsky answered this adequately for my purposes in the comment above, saying:
here are rtp examples, I think they work very similar (RTP is UDP based protocol with packet counting ability), why dont you just use udpsrc? – otopolsky Jan 28 at 8:21
I'm looking into what it takes to develop a PrintService on android. After reading some on-line docs I'm not quite clear on the format of data returned by PrintDocument.getData() method. I'd expect that in the case of PrintDocumentInfo.CONTENT_TYPE_PHOTO the returned data will be an image (I'm not quite sure about this). However, what can I expect when content type is CONTENT_TYPE_DOCUMENT?
There is a sample of PrintDocumentInfo that uses a builder to build a pdf file. Is this always the case? That is, is content of CONTENT_TYPE_DOCUMENT always in pdf format?
I'd appreciate any suggestions and/or pointers to relevant on-line docs.
Thanks.
It is always PDF for CONTENT_TYPE_DOCUMENT.
I have made a software that uses WebRTC DSP libraries (AEC, NS, AGC, VAD). Now I need to know what algorithm uses each one to write my Master´s Thesis, but I don't find any information about that.
Someone knows the algorithms of this libraries, specially the Acoustic Echo Cancellation (like for example NLMS, that I know it's commonly used, but I don't know if WebRTC also uses it).
I've tryed to know the algorithm looking into the source code, but I don't understand enough.
Thanks in advance!
I've just successfully using standalone WebRTC aecm module for android. and there's some tips:
1.the most important is the thing called "delay", you can find the definition of it in dir:
..\src\modules\audio_processing\include\audio_processing.h
quote:
Sets the |delay| in ms between AnalyzeReverseStream() receiving a
far-end frame and ProcessStream() receiving a near-end frame
containing the corresponding echo. On the client-side this can be
expressed as delay = (t_render - t_analyze) + (t_process - t_capture)
where,
t_analyze is the time a frame is passed to AnalyzeReverseStream() and t_render is the time the first sample of the same frame is
rendered by the audio hardware.
t_capture is the time the first sample of a frame is captured by the audio hardware and t_pull is the time the same frame is passed to
ProcessStream().
if you wanna use aecm module in standalone mode, be sure you obey this doc strictly.
2.AudioRecord and AudioTrack sometimes block(due to minimized buffer size), so when you calc the delay, don't forget adding blocking time to it.
3.if you don't know how to compile aecm module, you may learn Android NDK first, and the module src path is
..\src\modules\audio_processing\aecm
BTW, this blog may help a lot in native dev. and debuging.
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
hope this may help you.
From the code inspection of AGC algorithm in WebRtc, it matches closely with the description in http://www.ti.com/lit/wp/spraal1/spraal1.pdf
It's based on NLMS, but has a variable step length (mu).
Please explain me about what an AACExtractor.cpp is all about codewise.
Though the answer will not help the asker it will help other answer seekers .
AAC extractor.cpp is part of libstagefright.so , the stagefright media framework that handles playing of audio in android from .
AAC extractor is being used by awesome player.cpp which controls audio/video playback.
Its expected from AACextractor class
to help identify if the file is an "aacfile" (SniffAAC function )
it needs to implement methods that
extract information pertaining to meta-data (album art, artist etc.,)
extract necessary information from the file that is to be given to the codec
(sampling rate channels, initialize decoder , )
extract a frame and give it to the decoder .(support functions that implement seeking to particular frame etc.,)
These functions are used by other functions to get their work done.
This is an overview .The best way to understand is by printing logs .
Hope this helps
For more details look at
https://groups.google.com/forum/#!forum/android-porting
https://groups.google.com/forum/#!forum/android-framework