[FFmpeg-user] Flash Media Server .f4v aspect ratio weirdness.

Stuart Strader stredarts at gmail.com
Wed Apr 10 03:58:22 CEST 2013


Hi,

I'm trying to process webcam videos recorded by Flash Media Server 4.0. I'm
having trouble with ffmpeg not preserving the aspect ratio.

As you can see below, the info for stream #0.0 shows two aspect ratio
entries. One associated with the actual resolution and another from who
knows where.

...
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360
[SAR 1:1 DAR 16:9], 211 kb/s, SAR 3:4 DAR 4:3, 12.65 fps, 29.97 tbr, 1k
tbn, 59.94 tbc
...

I can force the aspect ratio to 16:9, however this would be far less than
ideal in my application, as users are able to free to choose the aspect
ratio they would like to capture in. So, is there any way to sanitize the
aspect ratio of these files?

Here is the sample file:
http://s3.amazonaws.com/ottw_dev/input_default_20130409_230929.f4v

```
ffmpeg -i input_default_20130409_230929.f4v -threads 0 -acodec libfaac -ab
96k -ar 44100 -b:v 700k output.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 25 2013 13:34:30 with Apple clang version 4.1
(tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2 --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
--enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc
--host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac
--enable-libmp3lame --enable-libxvid --enable-libvpx --enable-librtmp
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f86d901ae00] max_analyze_duration 5000000
reached at 5025000 microseconds
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input_default_20130409_230929.f4v':
  Metadata:
    major_brand     : f4v
    minor_version   : 0
    compatible_brands: isommp42m4v
    creation_time   : 2018-07-29 17:46:23
  Duration: 00:00:45.70, start: 0.000000, bitrate: 222 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
640x360 [SAR 1:1 DAR 16:9], 211 kb/s, SAR 3:4 DAR 4:3, 12.65 fps, 29.97
tbr, 1k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2018-07-29 17:46:23
      handler_name    : MainConcept
    Stream #0:1(eng): Audio: nellymoser (nmos / 0x736F6D6E), 8000 Hz, mono,
flt, 16 kb/s
    Metadata:
      creation_time   : 2018-07-29 17:46:23
      handler_name    : NellyMoser Handler
    Stream #0:2(eng): Data: none (amf0 / 0x30666D61)
    Metadata:
      creation_time   : 2018-07-29 17:46:23
      handler_name    : Timed Metadata Handler
File 'output.mp4' already exists. Overwrite ? [y/N] y
using SAR=3/4
[libx264 @ 0x7f86d904ac00] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.1 Cache64
[libx264 @ 0x7f86d904ac00] profile High, level 3.0
[libx264 @ 0x7f86d904ac00] 264 - core 125 r15137+7 123778f - H.264/MPEG-4
AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3
lookahead_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=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=700
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : f4v
    minor_version   : 0
    compatible_brands: isommp42m4v
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p,
640x360 [SAR 3:4 DAR 4:3], q=-1--1, 700 kb/s, 16728413.00 tbn, 29.97 tbc
    Metadata:
      creation_time   : 2018-07-29 17:46:23
      handler_name    : MainConcept
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono,
s16, 96 kb/s
    Metadata:
      creation_time   : 2018-07-29 17:46:23
      handler_name    : NellyMoser Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (nellymoser -> libfaac)
Press [q] to stop, [?] for help
frame= 1372 fps= 67 q=-1.0 Lsize=    4680kB time=00:00:45.74 bitrate=
838.0kbits/s dup=839 drop=0
video:4227kB audio:403kB subtitle:0 global headers:0kB muxing overhead
1.060890%
[libx264 @ 0x7f86d904ac00] frame I:6     Avg QP: 7.94  size: 53563
[libx264 @ 0x7f86d904ac00] frame P:447   Avg QP: 9.51  size:  8077
[libx264 @ 0x7f86d904ac00] frame B:919   Avg QP:16.30  size:   431
[libx264 @ 0x7f86d904ac00] consecutive B-frames:  9.8%  1.5%  3.3% 85.4%
[libx264 @ 0x7f86d904ac00] mb I  I16..4: 19.4% 22.5% 58.1%
[libx264 @ 0x7f86d904ac00] mb P  I16..4:  0.9%  1.8%  2.9%  P16..4: 24.7%
 6.9%  4.5%  0.0%  0.0%    skip:58.3%
[libx264 @ 0x7f86d904ac00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 16.4%
 0.9%  0.2%  direct: 0.3%  skip:82.1%  L0:49.0% L1:47.7% BI: 3.2%
[libx264 @ 0x7f86d904ac00] final ratefactor: 11.82
[libx264 @ 0x7f86d904ac00] 8x8 transform intra:30.7% inter:28.3%
[libx264 @ 0x7f86d904ac00] coded y,uvDC,uvAC intra: 84.6% 79.7% 72.2%
inter: 7.6% 6.1% 3.7%
[libx264 @ 0x7f86d904ac00] i16 v,h,dc,p: 34% 19% 17% 30%
[libx264 @ 0x7f86d904ac00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 23% 13%  3%
 4%  6%  3%  5%  4%
[libx264 @ 0x7f86d904ac00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 22% 10%  4%
 7%  7%  5%  5%  4%
[libx264 @ 0x7f86d904ac00] i8c dc,h,v,p: 35% 23% 28% 15%
[libx264 @ 0x7f86d904ac00] Weighted P-Frames: Y:0.7% UV:0.2%
[libx264 @ 0x7f86d904ac00] ref P L0: 84.2%  5.6%  8.9%  1.3%  0.0%
[libx264 @ 0x7f86d904ac00] ref B L0: 91.4%  8.1%  0.5%
[libx264 @ 0x7f86d904ac00] ref B L1: 93.8%  6.2%
[libx264 @ 0x7f86d904ac00] kb/s:756.31
```


More information about the ffmpeg-user mailing list