Opened 12 years ago

Closed 12 years ago

#1008 closed defect (invalid)

Can't generate video with undefined aspect

Reported by: hadmut Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hi,

I'm currently converting several videos (most from mpeg2 or mpeg4 with wrong aspect ratio) for efficient storing, watching with a streamer (such as WD TV Live) and iPad2. Usually using x264/aac as codecs, converting to ?x720, depending on the required ratio (in most cases 1280x720).

The problem: iPad2's computation power seems to be limited. While it can properly display most videos of my collection (especially with lower resolutions), it has trouble, hangs or even stops playing 1280x720 videos generated with ffmpeg. Lower resolutions solve the problem, but obviously reduce quality.

But then, I have other videos downloaded from the Web (or youtube) which as well are 1280x720, H264, AAC, and they are displayed correctly on the iPad.

The only difference I have figured out so far is that in those videos iPad can play without problems the Video Aspect (as reported by mplayer) is undefined. I guess that this might cause the iPad to rescale images and waste computation time.

The problem with ffmpeg: I can't remove the aspect ratio. If I omit the -aspect parameter, ffmpeg copies the (wrong) aspect ratio from the MPEG2 (=1.333). If I use the -aspect parameter, ffmpeg rejects giving 0 as a parameter.

So I don't see any way to create a video with ffmpeg where the aspect is not set (i.e. just use the width/height).

(ffmpeg version is 0.7.3 as of ubuntu latest, but this ticket system does not offer this version for selection)

regards

Change History (8)

in reply to:  description comment:1 by Carl Eugen Hoyos, 12 years ago

Replying to hadmut:

(ffmpeg version is 0.7.3 as of ubuntu latest, but this ticket system does not offer this version for selection)

This is an intentionally broken version of FFmpeg with several hundred regressions (see this bug tracker for many examples), some of them security relevant. It is therefore unsupported here. Please see http://ffmpeg.org/download.html for supported releases, but if you are a user, only use current git head, it contains more features and less bugs than any released version.
Please add a command line that produces unplayable files together with the complete, uncut console output. It is very unlikely that your problem is related to video-aspect, I suspect the x264 options will make the difference.

comment:2 by hadmut, 12 years ago

After further reading about H264, I presume something different. I read about H264 beeing a family of different encodings, where some of them are supported by hardware decoders of mobile devices, and others are not. This might explain why my iPad2 can smoothly play some H264 1280x720 videos downloaded from the Internet, while it can't those generated with ffmpeg here.

Command line and output is (here I am converting a video that is already H264, but has a wrong ration):

% ffmpeg -i sample_in.mp4 -vcodec libx264 -vpre superfast -b 2000k -acodec copy -s 1280x720 -aspect 16:9 sample_out.mp4
ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers

built on Jan 4 2012 16:08:51 with gcc 4.6.1
configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
avutil configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avcodec configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avformat configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avdevice configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
swscale configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
postproc configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 6. 0 / 53. 6. 0
libavformat 53. 3. 0 / 53. 3. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample_in.mp4':

Metadata:

major_brand : mp42
minor_version : 0
compatible_brands: isomavc1mp42
creation_time : 2009-11-05 05:40:21

Duration: 00:04:07.40, start: 0.000000, bitrate: 3534 kb/s

Stream #0.0(und): Audio: aac, 44100 Hz, stereo, s16, 120 kb/s
Metadata:

creation_time : 2009-11-05 05:40:21

Stream #0.1(und): Video: h264 (High), yuv420p, 1440x1080 [PAR 1:1 DAR 4:3], 3411 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
Metadata:

creation_time : 2009-11-05 05:40:22

[buffer @ 0x186f320] w:1440 h:1080 pixfmt:yuv420p
[scale @ 0x18529e0] w:1440 h:1080 fmt:yuv420p -> w:1280 h:720 fmt:yuv420p flags:0x4
[libx264 @ 0x18603e0] using SAR=1/1
[libx264 @ 0x18603e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x18603e0] profile High, level 3.1
[libx264 @ 0x18603e0] 264 - core 116 r2042 178455c - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.41 pb_ratio=1.25 aq=1:1.00
Output #0, mp4, to 'sample_out.mp4':

Metadata:

major_brand : mp42
minor_version : 0
compatible_brands: isomavc1mp42
creation_time : 2009-11-05 05:40:21
encoder : Lavf53.3.0
Stream #0.0(und): Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=0-69, 2000 kb/s, 25 tbn, 25 tbc
Metadata:

creation_time : 2009-11-05 05:40:22

Stream #0.1(und): Audio: libvo_aacenc, 44100 Hz, stereo, 120 kb/s
Metadata:

creation_time : 2009-11-05 05:40:21

Stream mapping:

Stream #0.1 -> #0.0
Stream #0.0 -> #0.1

Press ctrl-c to stop encoding
frame= 6185 fps= 42 q=4.0 Lsize= 64139kB time=247.32 bitrate=2124.5kbits/s
video:60332kB audio:3632kB global headers:0kB muxing overhead 0.273991%
frame I:48 Avg QP:17.57 size: 39540
[libx264 @ 0x18603e0] frame P:3117 Avg QP:18.80 size: 14396
[libx264 @ 0x18603e0] frame B:3020 Avg QP:20.77 size: 4970
[libx264 @ 0x18603e0] consecutive B-frames: 16.4% 51.9% 11.1% 20.7%
[libx264 @ 0x18603e0] mb I I16..4: 21.5% 55.3% 23.2%
[libx264 @ 0x18603e0] mb P I16..4: 16.1% 14.3% 0.7% P16..4: 58.2% 0.0% 0.0% 0.0% 0.0% skip:10.7%
[libx264 @ 0x18603e0] mb B I16..4: 2.7% 1.5% 0.0% B16..8: 30.2% 0.0% 0.0% direct:15.8% skip:49.7% L0:35.8% L1:55.1% BI: 9.1%
[libx264 @ 0x18603e0] final ratefactor: 25.24
[libx264 @ 0x18603e0] 8x8 transform intra:45.1% inter:44.6%
[libx264 @ 0x18603e0] coded y,uvDC,uvAC intra: 22.2% 61.3% 29.3% inter: 10.5% 35.0% 1.6%
[libx264 @ 0x18603e0] i16 v,h,dc,p: 56% 26% 13% 5%
[libx264 @ 0x18603e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 18% 37% 3% 7% 5% 7% 3% 6%
[libx264 @ 0x18603e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 22% 21% 3% 6% 6% 5% 5% 6%
[libx264 @ 0x18603e0] i8c dc,h,v,p: 41% 27% 20% 12%
[libx264 @ 0x18603e0] kb/s:1997.71

comment:3 by hadmut, 12 years ago

For some reason I really don't understand that sample worked on the iPad although I'd taken the command line from the history as I used it yesterday. The only difference is that I used -vpre ultrafast and -vpre medium yesterday.

Could this make the difference?

comment:4 by hadmut, 12 years ago

Nah, it worked only once, not again.

in reply to:  2 comment:5 by Carl Eugen Hoyos, 12 years ago

Replying to hadmut:

ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1

Please understand that this is an intentionally broken version of FFmpeg with many bugs, some of them security relevant. This version is therefore unsupported here!

comment:6 by reimar, 12 years ago

iPad has a hardware decoder, so it is quite difficult to give specific recommendations.
x264 might have some special options for these (not sure), but otherwise there is the generic "fastdecode" tune setting which makes sure the video is easy to decode (I don't know right now how to set that from FFmpeg).

comment:7 by xanadonf, 12 years ago

Ok, I found the problem.

I was compiling libvpx with yasm 1.0.0.
I've just compiled libvpx with yasm 1.2.0 and it's fine now.

You can close the incident, big chances this is a libvpx one.

comment:8 by Carl Eugen Hoyos, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.