You are not logged in.

#1 2012-01-12 16:35:38

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Broken encode x264/aac after ffmpeg update

Hi.

I use following command for encode a video from camera:

$ ffmpeg -i /tmp/test.avi -vf hqdn3d=2:1:2 -vcodec libx264 -threads 12 -vprofile high -preset veryslow -x264opts level=30:ref=6:deblock=-2,-2:dct-decimate=0:fast_pskip=0:direct=auto:qpmax=51:keyint=300:bitrate=900:threads=12 -acodec aac -ab 88 -strict experimental -ar 48000 /tmp/video.mp4

After upgrade ffmpeg (20111211-1 -> 20120111-1) I  recieve errors:

malformated aac bitstream, use -absf aac_adtstoasc00:00.00 bitrate=   0.0kbits/s    
av_interleaved_write_frame(): Operation not permitted

With 20111211-1 above command works fine.

With mencoder:

$ mencoder "test.avi" -aspect 4:3 -noskip -mc 0 -vf hqdn3d=2:1:2 -ovc x264 -x264encopts  profile=high:level=30:preset=veryslow:crf=6:deblock=-2,-2:dct-decimate=0:fast_pskip=0:direct=auto:qpmax=51:keyint=300:bitrate=900:threads=12 -ofps 30 -af resample=48000,channels=2 -srate 48000 -oac faac -faacopts quality=25 -of lavf -lavfopts format=mp4 -o "video.mp4"

get

[mp4 @ 0xdd5b60]malformated aac bitstream, use -absf aac_adtstoasc
Error while writing frame.

Mediainfo source file:

$ mediainfo test.avi 
General
Complete name                            : test.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 317 MiB
Duration                                 : 2mn 58s
Overall bit rate                         : 14.9 Mbps
Mastered date                            : Wed Nov 16 00:03:55 2011
Writing application                      : CanonMVI06

Video
ID                                       : 0
Format                                   : JPEG
Codec ID                                 : MJPG
Duration                                 : 2mn 58s
Bit rate                                 : 14.8 Mbps
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 30.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 1.608
Stream size                              : 315 MiB (99%)

Audio
ID                                       : 1
Format                                   : PCM
Format settings, Sign                    : Unsigned
Codec ID                                 : 1
Duration                                 : 2mn 58s
Bit rate mode                            : Constant
Bit rate                                 : 88.2 Kbps
Channel(s)                               : 1 channel
Sampling rate                            : 11.024 KHz
Bit depth                                : 8 bits
Stream size                              : 1.87 MiB (1%)
Interleave, duration                     : 995 ms (29.85 video frames)
Interleave, preload duration             : 1000 ms

Last edited by unikum (2012-01-12 20:39:17)

Offline

#2 2012-01-12 17:38:43

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: Broken encode x264/aac after ffmpeg update

Seems it is related with mp4 container because same command with avi output works fine.

Last edited by unikum (2012-01-12 18:00:32)

Offline

#3 2012-01-12 18:15:47

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: Broken encode x264/aac after ffmpeg update

report it upstream


Give what you have. To someone, it may be better than you dare to think.

Offline

#4 2012-01-14 08:55:25

attejensen
Member
Registered: 2011-05-22
Posts: 2

Re: Broken encode x264/aac after ffmpeg update

Did you manage to find any solution, while we wait for a fix?

Offline

#5 2012-01-14 10:00:43

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: Broken encode x264/aac after ffmpeg update

@wonder: I'm not too good at this. May be you? smile
@attejensen: I build mp4 with MP4Box. ffmpeg only encode tracks. Wait fix from upstream.

Offline

#6 2012-01-16 19:05:13

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: Broken encode x264/aac after ffmpeg update

unikum wrote:

Hi.

I use following command for encode a video from camera:

$ ffmpeg -i /tmp/test.avi -vf hqdn3d=2:1:2 -vcodec libx264 -threads 12 -vprofile high -preset veryslow -x264opts level=30:ref=6:deblock=-2,-2:dct-decimate=0:fast_pskip=0:direct=auto:qpmax=51:keyint=300:bitrate=900:threads=12 -acodec aac -ab 88 -strict experimental -ar 48000 /tmp/video.mp4

After upgrade ffmpeg (20111211-1 -> 20120111-1) I  recieve errors:

malformated aac bitstream, use -absf aac_adtstoasc00:00.00 bitrate=   0.0kbits/s    
av_interleaved_write_frame(): Operation not permitted

You're attempting to encode your audio with 88 bits per second. Try adding a "k", as in -ab 88k, because I assume you actually want 88 kilobits/s. FFmpeg may have given you a warning about this in the complete console output. If you still get the error try adding -absf aac_adtstoasc as the output mentions.

Secondly, please provide the most simple command that still produces the error. I'm sure you can eliminate a large number of the options to narrow down which option(s) may be causing the issue.

Did you create this command yourself or did you copy it from somewhere? I'd like to know why you are declaring so many x264opts.

Edit: If you do report anything upstream please note that you should be very detailed about your reports. You won't get flamed, but you may be asked several times for more information to narrow down the issue. Minimally you should provide the simplest command that allows someone to duplicate the issue, provide the complete and uncut ffmpeg console output, test a publicly available input (such as MPlayer samples or provide a small sample), and maybe even test current FFmpeg Git head (although wonder does a damned good job at using current FFmpeg here at Arch; more so than any other distro that I am familiar with).

Last edited by DrZaius (2012-01-16 19:15:25)

Offline

#7 2012-01-16 20:25:49

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: Broken encode x264/aac after ffmpeg update

DrZaius wrote:

You're attempting to encode your audio with 88 bits per second. Try adding a "k", as in -ab 88k, because I assume you actually want 88 kilobits/s. FFmpeg may have given you a warning about this in the complete console output. If you still get the error try adding -absf aac_adtstoasc as the output mentions.

Complete output:

ffmpeg -i /tmp/test.avi -vf hqdn3d=2:1:2 -vcodec libx264 -threads 12 -vprofile high -preset veryslow -x264opts level=30:ref=6:deblock=-2,-2:dct-decimate=0:fast_pskip=0:direct=auto:qpmax=51:keyint=300:bitrate=900:threads=12 -acodec aac -ab 88k -strict experimental -ar 48000 /tmp/video.mp4
ffmpeg version N-36713-gbc11580 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 11 2012 22:43:11 with gcc 4.6.2 20111223 (prerelease)
  configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-libgsm --enable-libspeex --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug --disable-static
  libavutil      51. 34.100 / 51. 34.100
  libavcodec     53. 54.100 / 53. 54.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 58.100 /  2. 58.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    51.  2.100 / 51.  2.100
Input #0, avi, from '/tmp/test.avi':
  Metadata:
    creation_time   : 2009-10-14 19:19:59
    encoder         : CanonMVI06
  Duration: 00:01:44.13, start: 0.000000, bitrate: 14587 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11024 Hz, 1 channels, u8, 88 kb/s
Incompatible pixel format 'yuvj422p' for codec 'libx264', auto-selecting format 'yuvj420p'
[buffer @ 0x6e2960] w:640 h:480 pixfmt:yuvj422p tb:1/1000000 sar:0/1 sws_param:                               
[hqdn3d @ 0x6bf0e0] ls:2.000000 cs:1.000000 lt:2.000000 ct:1.000000
[buffersink @ 0x6b9d40] auto-inserting filter 'auto-inserted scale 0' between the filter 'Parsed_hqdn3d_0' and the filter 'out'
[hqdn3d @ 0x6bf0e0] auto-inserting filter 'auto-inserted scale 1' between the filter 'src' and the filter 'Parsed_hqdn3d_0'
[scale @ 0x6ec040] w:640 h:480 fmt:yuvj422p -> w:640 h:480 fmt:yuv420p flags:0x4
[scale @ 0x6eb640] w:640 h:480 fmt:yuv420p -> w:640 h:480 fmt:yuvj420p flags:0x4
Incompatible sample format 'u8' for codec 'aac', auto-selecting format 's16'
[libx264 @ 0x6bab80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX                       
[libx264 @ 0x6bab80] profile High, level 3.0
[libx264 @ 0x6bab80] 264 - core 119 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=6 deblock=1:-2:-2 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=12 sliced_threads=0 nr=0 decimate=0 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=300 keyint_min=30 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=abr mbtree=1 bitrate=900 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/tmp/video.mp4':
  Metadata:
    creation_time   : 2009-10-14 19:19:59
    encoder         : Lavf53.29.100
    Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuvj420p, 640x480, q=-1--1, 900 kb/s, 1000k tbn, 30 tbc
    Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, 1 channels, s16, 88 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> libx264)
  Stream #0:1 -> #0:1 (pcm_u8 -> aac)
Press [q] to stop, [?] for help
malformated aac bitstream, use -absf aac_adtstoasc00:00.00 bitrate=   0.0kbits/s    
av_interleaved_write_frame(): Operation not permitted  
DrZaius wrote:

Secondly, please provide the most simple command that still produces the error. I'm sure you can eliminate a large number of the options to narrow down which option(s) may be causing the issue.

More simple command:

ffmpeg -i /tmp/test.avi -vcodec copy -acodec aac -ab 88k -strict experimental -ar 48000 -y /tmp/video.mp4
ffmpeg version N-36713-gbc11580 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 11 2012 22:43:11 with gcc 4.6.2 20111223 (prerelease)
  configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-libgsm --enable-libspeex --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug --disable-static
  libavutil      51. 34.100 / 51. 34.100
  libavcodec     53. 54.100 / 53. 54.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 58.100 /  2. 58.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    51.  2.100 / 51.  2.100
Input #0, avi, from '/tmp/test.avi':
  Metadata:
    creation_time   : 2009-10-14 19:19:59
    encoder         : CanonMVI06
  Duration: 00:01:44.13, start: 0.000000, bitrate: 14587 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11024 Hz, 1 channels, u8, 88 kb/s
Incompatible sample format 'u8' for codec 'aac', auto-selecting format 's16'
Output #0, mp4, to '/tmp/video.mp4':                                                                          
  Metadata:
    creation_time   : 2009-10-14 19:19:59
    encoder         : Lavf53.29.100
    Stream #0:0: Video: mjpeg (l[0][0][0] / 0x006C), yuvj422p, 640x480, q=2-31, 1000k tbn, 30 tbc
    Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, 1 channels, s16, 88 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_u8 -> aac)
Press [q] to stop, [?] for help
[mp4 @ 0x211dd20] malformated aac bitstream, use -absf aac_adtstoasc
av_interleaved_write_frame(): Operation not permitted 

Error occurs when try mux aac audio in the mp4 conteiner.

DrZaius wrote:

Did you create this command yourself or did you copy it from somewhere? I'd like to know why you are declaring so many x264opts.

I carefully chose these settings based on x264 documentation.

Offline

#8 2012-01-17 21:24:29

windoze007
Member
Registered: 2012-01-17
Posts: 1

Re: Broken encode x264/aac after ffmpeg update

Not sure if this helps, but I got the source, and the message was introduced here: git diff c22f2527ed33c42^ c22f2527ed33c42
This may be the issue, but I cannot confirm. Also, I can run the code with -acodec ac3 but not do -acodec aac.

+    } 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;

Offline

#9 2012-01-17 22:46:17

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: Broken encode x264/aac after ffmpeg update

@windoze007: I can encode to aac (separate audio track in .aac file), but not able mux to mp4.

Offline

#10 2012-02-02 21:53:01

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: Broken encode x264/aac after ffmpeg update

I not understand about reasons, but now all works fine.

Offline

Board footer

Powered by FluxBB