When I am converting an mp4 to flv how to account for the time offsets in the elst list? What are the scenarios in which an elst atom would be inserted in an mp4 file?
Related
I am learning how png works and trying to create a simple PNG decoder with "pure" C++.
My problem is that I don't know how zlib headers are stored in multiple IDAT-PNG chunks. The first IDAT chunk looks fine - a normal "CM" and "CINFO", but when I read the next IDAT chunk the zlib header looks strange, the "CM" can be a random number - not 8 as default and the "CINFO" can be above 7 - I readed that "CINFO" with a number above 7 is marked as corrupted/not acceptable. So where can I find some information about this? -I didn't find anything about handling multiple IDAT chunks on the web. (Uh, I find something here - in "StackOverFlow", but it doesn't seem to describe how zlib headers are stored in multiple IDAT chunks so it doesn't answer my question)
I read the RFC 1950 about zlib.
https://www.rfc-editor.org/rfc/rfc1950
There is only one zlib header, in the first chunk. The series of IDAT chunks is a single zlib stream, broken up into pieces.
You need to read the PNG spec more carefully.
I have an issue with FLV stream generating. I've developed DVR system, an it should be able to stream video in FLV format (to play it on Actionscript NetStream). I receive video from encoder in raw H264 NAL units (0x00 0x00 0x00 0x01 ), also I can recognize is encoded frame IDR or non-IDR.
My solution to create FLV stream (based on Adobe spec: Video File Format Specification Version 10) was:
wait for IDR frame;
put FLV header
put PrevTagSize(0)
put FLV tag with video tag VIDEODATA with AVCVIDEODATA
put PrevTagSize
repeat steps 4,5 till end of streaming.
Stream looks good, and can be playable by ffplay, mplayer, vlc, etc.
But not played by player based on Actionscript NetStream.
So, I've get raw h264 data and convert it to FLV using ffmpeg:
ffmpeg -f h264 -i d1.h264 -vcodec copy -f flv d1.flv
and try to compate both flv's my and ffmpeg's.
First of all I see that ffmpeg adds AVC sequence header, immediately after FLV header.
I've started to do the same, but NetStream still not support my stream, and also another players ceased to play it.
Ok, then I've continue to compare flv's.
Now I see that NAL unit headers in ffmpeg's coded FLV a bit changed, but I can't understand what the meaning of the changes. I read many specs, but nothing helpful.
Did anybody can clarify me this?
Fo example my NAL units looks so:
00 00 00 01 XX XX ... - for all units
FFmpeg NALs:
00 00 [14 BA] 61 9A ... - non IDR (two bytes variable)
00 00 [7A 02] 65 88 ... - IDR (two bytes variable)
00 00 00 40 06 05 ... - SEI
Is there added some counter or anything else?
Will be happy to see any ideas, links, etc.
Try to use following command to do the work:
ffmpeg -y -i test.flv -vcodec copy -vbsf h264_mp4toannexb test.h264
You will got a vlc playable .h264 file, all NAL is begin with 00 00 00 01.
There are two common H.264 bitstream packing formats.
Annex B contains start codes: 00 00 01
MP4 is length prefixed XX XX XX XX
You are creating annex B but it seems like you need mp4 packing format (length prefixed) for FLV.
You have to remove (00) 00 00 01 and add the length as prefix.
I want to do a project to convert different file formats to pdf. The file formats are
o Images: .jpg, .tiff, .gif
o Microsoft Word: .doc and .docx
o Microsoft PowerPoint: .ppt and .pptx
o Microsoft Excel: .xls and .xlsx
o Web pages: .htm and .html
o Apple Keynote: .key
o Apple Numbers: .numbers
o Apple Pages: .pages
o Text: .txt
Images and text can be converted to pdf and then stored. But can other file formats be converted. Can any one help with a link or something which promotes this. Any help is appreciated.
Thanks
yes, xlsx or pdfx are some kind of xml files (http://en.wikipedia.org/wiki/Office_Open_XML). So you can parse and render the files by your self.
I have a file that only contains the mdat atom in a MP4 container. The data in the mdat contains AVC data. I know the encoding parameters for the data. The format does not appear to be in the Annex B byte stream format. I am wondering how I would go about parsing this. I have tried searching for the slice header, but have not had much luck.
Is it possible to parse the slices without the NAL's?
AVC NAL units are in the following format in MDAT section:
[4 bytes] = NAL length, network order;
[NAL bytes]
Shortly, start codes are simply replaced by lengths.
Be careful! The NAL Length is not required to be 4! The AvcConfigurationBox ('moov/trak/mdia/minf/stbl/stsd/avc1/avcC') contains a field 'lengthSizeMinusOne' specifying the length. But the default is 4.
I found what michael was talking about defined in section 5.2.3 of ISO 14496-15.
Sebastian's answer refers to section 5.2.4.1.1 and 5.3.4.1.2.
You will not be able to parse the slices in the 'mdat' box without copies of the SPS and PPS from the 'avcC' box (defined in section 5.2.4.1.1)
I wanna know how the onMetaData marker in FLV files looks like. When i open FLV files as plain text I get this:
FLV[][][][][](TAB)[][][][][][][]8[][][][][][][][][]
onMetaData[]
duration...
The docs say the first 3 bytes are the signature "FLV" the next byte tells the flv version, the next byte is telling us if audio or video tags are present, the next 4 bytes are the data-offset(the size of the header), which is 9, in ascii its the TAB code. after the TAB starts the body with the fist "previous tag size field" which is 0(4 bytes) next, there is the Tag Type (1 byte) the data size (3 bytes) and the timestamp (4 bytes) the stream id (always 0, 3bytes). After that remains:
[]
onMetaData[]
[][][][][][]
duration...
I suppose the onMetaData marker is "1byte, newline"onMetaData"1byte,newline) but what are the 7 bytes between onMetaData marker and duration?
You would need to view this file in a hex editor to get anything useful from it; a text editor will just show you unprintable characters.
The ASCII "onMetaData" bit in the file is the tag header, which is wrapping the "duration" field. The three bytes immediately after "onMetaData" are the BodyLength of the tag (uint24, big-endian), and the next 4 bytes ("\x00\x00\x00\x08") describe the length of the name for the next tag, which is "duration."
I suggest you to use hexedit tool http://www.hexedit.com/
this will allow you to see all the info in string format..
as well as it has very nice navigation to analyze bytes.
In addition to it, use https://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf to get details about all bytes in an flv file
Remember that the metadata is encoded using AMF. This means that after the string "onMetaData" you have a 0x08 to signify the start of an array and then 2 bytes to signify the length of the first element as number of character/bytes