Latest FFMPEG 0.9 Issues
I have been working with the latest ffmpeg 0.9 release and discovered the following issues which did not exist in the last ffmpeg I have been using from Jan 2011. 1. AAC audio decode. I have a number of (H264+AAC) sequences which decoded fine but now I get an error in the first packet and works fine from there on. I found the issue in parse_adts_frame_header() function in aacdec.c. The sequence is initialized with ac->m4ac.chan_config = 2. But this function sets it to 0. Hence it fails in aac_decode_frame_int() and produces the following error: if (!(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); return -1; } The old ffmpeg initialized ac->m4ac.chan_config to 0 and set it to 2 in the parse_adts_frame_header(). Commenting out ac->m4ac.chan_config = 0; in parse_adts_frame_header() works great. 2. AAC Encode to flv and mp4/mov If the first aac packet has the 2 byte header and payload together, the old ffmpeg encoded it correctly. The new ffmpeg checks for the pkt size to be 2 and errors. flvenc.c - flv_write_packet() and movenc.c - ff_mov_write_packet() have the following lines of code: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; Commenting this out the pkt->size > 2 works great. Otherwise we need to use -absf aac_adtstoasc. 3. Multibitrate output in one copy and one transcoded mode - FATA ERROR The following configuration crashes ffmpeg: ffmpeg -y -i Cricket-360p-600k.flv -an -vcodec copy -vbsf h264_mp4toannexb x1.ts -an -vcodec libx264 -preset superfast -b:v 300k -vbsf h264_mp4toannexb x2.ts The same happens for -acodec copy instead of -an in one or both outputs. av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); in transcode_video() in ffmpeg.c has a NULL src buffer. Several other combinations have similar issues. Chanchal Chatterjee
On Thu, Dec 29, 2011 at 12:04:23PM -0800, C Chatterjee wrote:
I have been working with the latest ffmpeg 0.9 release and discovered the following issues which did not exist in the last ffmpeg I have been using from Jan 2011.
1. AAC audio decode. I have a number of (H264+AAC) sequences which decoded fine but now I get an error in the first packet and works fine from there on. I found the issue in parse_adts_frame_header() function in aacdec.c. The sequence is initialized with ac->m4ac.chan_config = 2. But this function sets it to 0. Hence it fails in aac_decode_frame_int() and produces the following error: if (!(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); return -1; } The old ffmpeg initialized ac->m4ac.chan_config to 0 and set it to 2 in the parse_adts_frame_header(). Commenting out ac->m4ac.chan_config = 0; in parse_adts_frame_header() works great.
can you upload a sample or provide a url of an existing sample with which this is reproduceable ?
2. AAC Encode to flv and mp4/mov If the first aac packet has the 2 byte header and payload together, the old ffmpeg encoded it correctly. The new ffmpeg checks for the pkt size to be 2 and errors. flvenc.c - flv_write_packet() and movenc.c - ff_mov_write_packet() have the following lines of code:
else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1;
Commenting this out the pkt->size > 2 works great. Otherwise we need to use -absf aac_adtstoasc.
I suspect the files generated without the check are invalid and will not play on all players. But i may be wrong [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange
Michael: Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier. On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as: ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used. Chanchal Date: Fri, 30 Dec 2011 22:21:02 +0100 From: michaelni@gmx.at To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] Latest FFMPEG 0.9 Issues On Thu, Dec 29, 2011 at 12:04:23PM -0800, C Chatterjee wrote:
I have been working with the latest ffmpeg 0.9 release and discovered the following issues which did not exist in the last ffmpeg I have been using from Jan 2011.
1. AAC audio decode. I have a number of (H264+AAC) sequences which decoded fine but now I get an error in the first packet and works fine from there on. I found the issue in parse_adts_frame_header() function in aacdec.c. The sequence is initialized with ac->m4ac.chan_config = 2. But this function sets it to 0. Hence it fails in aac_decode_frame_int() and produces the following error: if (!(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); return -1; } The old ffmpeg initialized ac->m4ac.chan_config to 0 and set it to 2 in the parse_adts_frame_header(). Commenting out ac->m4ac.chan_config = 0; in parse_adts_frame_header() works great.
can you upload a sample or provide a url of an existing sample with which this is reproduceable ?
2. AAC Encode to flv and mp4/mov If the first aac packet has the 2 byte header and payload together, the old ffmpeg encoded it correctly. The new ffmpeg checks for the pkt size to be 2 and errors. flvenc.c - flv_write_packet() and movenc.c - ff_mov_write_packet() have the following lines of code:
else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1;
Commenting this out the pkt->size > 2 works great. Otherwise we need to use -absf aac_adtstoasc.
I suspect the files generated without the check are invalid and will not play on all players. But i may be wrong [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML.
On Sat, Dec 31, 2011 at 05:23:21PM +0100, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
Check removed if someone still remembers for what case it is needed then i can put it back [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
On Sun, Mar 11, 2012 at 9:25 PM, Michael Niedermayer <michaelni@gmx.at> wrote:
On Sat, Dec 31, 2011 at 05:23:21PM +0100, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
This can't be at the start of a non-ADTS payload. 111 is the EndOfFrame syntax element.
Check removed if someone still remembers for what case it is needed then i can put it back
[...]
-- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
Just fyi I removed the check and generating flv and spts which are working great with flash and ios players. Have not tried other players. Chanchal Chatterjee On Mar 12, 2012, at 9:44 AM, Aℓex Converse <aconverse@google.com> wrote:
On Sun, Mar 11, 2012 at 9:25 PM, Michael Niedermayer <michaelni@gmx.at> wrote:
On Sat, Dec 31, 2011 at 05:23:21PM +0100, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
This can't be at the start of a non-ADTS payload. 111 is the EndOfFrame syntax element.
Check removed if someone still remembers for what case it is needed then i can put it back
[...]
-- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On Mon, Mar 12, 2012 at 09:44:59AM -0700, Aℓex Converse wrote:
On Sun, Mar 11, 2012 at 9:25 PM, Michael Niedermayer <michaelni@gmx.at> wrote:
On Sat, Dec 31, 2011 at 05:23:21PM +0100, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
This can't be at the start of a non-ADTS payload. 111 is the EndOfFrame syntax element.
Thanks also thanks to baptiste for the spec link Ill revert it in a moment [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates
On 12/31/11 8:23 AM, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
The check is there to prevent muxing adts in flv, AFAIK flv requires raw aac. Copying from flv to flv means copying raw aac to raw aac and should not trigger that problem unless xx.flv had already been wrongly muxed. IMHO it is not a good idea to remove that check. -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
On Sun, Mar 11, 2012 at 11:35:37PM -0700, Baptiste Coudurier wrote:
On 12/31/11 8:23 AM, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
The check is there to prevent muxing adts in flv, AFAIK flv requires raw aac.
do you know of some player that fails with adts or is there a spec that says what is allowed to be put in flv ?
Copying from flv to flv means copying raw aac to raw aac and should not trigger that problem unless xx.flv had already been wrongly muxed.
IMHO it is not a good idea to remove that check.
as said i can put it back ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates
On 03/12/2012 07:44 AM, Michael Niedermayer wrote:
On Sun, Mar 11, 2012 at 11:35:37PM -0700, Baptiste Coudurier wrote:
On 12/31/11 8:23 AM, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
The check is there to prevent muxing adts in flv, AFAIK flv requires raw aac.
do you know of some player that fails with adts or is there a spec that says what is allowed to be put in flv ?
Adobe specs http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf [...] -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
Thanks Bapiste. The test is there in flvenc.c and movenc.c The doc below will justify why the check is needed in flvenc.c, but why do we need it in movenc.c? Chanchal
Date: Mon, 12 Mar 2012 10:06:04 -0700 From: baptiste.coudurier@gmail.com To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] Latest FFMPEG 0.9 Issues
On 03/12/2012 07:44 AM, Michael Niedermayer wrote:
On Sun, Mar 11, 2012 at 11:35:37PM -0700, Baptiste Coudurier wrote:
On 12/31/11 8:23 AM, Michael Niedermayer wrote:
On Fri, Dec 30, 2011 at 09:52:21PM -0800, C Chatterjee wrote:
Michael:
Thanks for fixing the aacdec.c bug in item 1 below in an email sent by you earlier.
On item 2 I believe that checking as below: else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; may not be necessary because the 2 byte header can be at the start of a payload too. I have used this stream on a number of players - VLC, Flash and iPhone. All works. Is there a case of a player where it does not work. I comment out the lines above in flvenc.c and movenc.c and use ffmpeg as:
ffmpeg -y -i xx.flv -acodec copy -vcodec -preset superfast -b:v 150k ff.flv ff.flv works fine on all players I have used.
hmm, maybe baptiste, mike or alex could comment on if this check is or is not required ?
The check is there to prevent muxing adts in flv, AFAIK flv requires raw aac.
do you know of some player that fails with adts or is there a spec that says what is allowed to be put in flv ?
Adobe specs http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf
[...]
-- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
participants (5)
-
Aℓex Converse -
Baptiste Coudurier -
C Chatterjee -
C. Chatterjee -
Michael Niedermayer