[FFmpeg-user] setdar/setsar not working correctly with libvpx on 32 bit Ubuntu

Philip Kahle philip.kahle at gmail.com
Thu Dec 6 15:35:23 CET 2012


Hi everyone,

I want to transcode mp4 files (with wrong DAR=5:4 and SAR=1:1) into webm
using ffmpeg and thereby set the aspect ratios to DAR=4:3 and SAR=16:15.

Command:

/usr/local/bin/ffmpeg -i mp4_test.mp4 -vcodec libvpx -acodec libvorbis -vf
setdar='4:3' out_mp4-webm_setdaronly.webm

This works well on a machine running Ubuntu 12.04 64 bit and also on Centos
6.
However I am running Ubuntu 12.04 32bit on the production machine and
exactly this setup produces erroneous files with SAR=212:199 and
DAR=265:199 on the very same input.
The ffmpeg console output thereby contains the correct values (DAR=4:3 and
SAR=16:15) for the produced vp8 stream but ffprobe tells the
afore-mentioned wrong values.
The result was the same for an uncompressed avi with no values for DAR/SAR.
Using setsar=16:15 and both setdar and setsar does not make a difference.

I tried Ffmpeg versions 1.0, 1.0.1 and the current one from git with the
same result.

Differences on the other machines are:
Ubuntu 64 bit: nothing but the runtime environment.
Centos: more recent libogg (1.3.0), libvorbis (1.3.3) but older gcc (GCC)
4.4.6 20120305 (Red Hat 4.4.6-4)

The attached text files contain shell outputs from ffmpeg and ffprobe.

I already tried both libvpx from the Ubuntu repository (1.0.0.1) and the
current git version (1.1.0) built upon:

./configure --extra-cflags="-fPIC" --enable-pic --enable-shared

The attached text files contain shell outputs from ffmpeg and ffprobe.

Can anyone reproduce this?

Regards,

Philip
-------------- next part --------------
/usr/local/bin/ffmpeg -v debug -i mp4_test.mp4 -vcodec libvpx -acodec libvorbis -vf setdar=4:3 -f webm out_mp4-webm_setdaronly.webm
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec  3 2012 17:02:53 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --prefix=/usr/local/ --enable-shared --enable-avfilter --enable-libvorbis --enable-pthreads --enable-libvpx --enable-gpl --enable-pic
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8516500] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8516500] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8516500] File position before avformat_find_stream_info() is 7551734
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8516500] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8516500] File position after avformat_find_stream_info() is 34562
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mp4_test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Umile Encoder 3
  Duration: 00:00:10.40, start: 0.000000, bitrate: 5809 kb/s
    Stream #0:0(und), 1, 1/25: Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 1/25, 5612 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 192 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
[Parsed_setdar_0 @ 0x851e920] a:4/3
[buffer @ 0x852ef20] Setting entry with key 'video_size' to value '720x576'
[buffer @ 0x852ef20] Setting entry with key 'pix_fmt' to value '0'
[buffer @ 0x852ef20] Setting entry with key 'time_base' to value '1/25'
[buffer @ 0x852ef20] Setting entry with key 'pixel_aspect' to value '1/1'
[buffer @ 0x852ef20] Setting entry with key 'sws_param' to value 'flags=2'
[buffer @ 0x852ef20] Setting entry with key 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x853e5c0] w:720 h:576 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1 sws_param:flags=2
[Parsed_setdar_0 @ 0x851e920] w:720 h:576 -> dar:4/3 sar:16/15
[abuffer @ 0x853e040] Setting entry with key 'time_base' to value '1/48000'
[abuffer @ 0x853e040] Setting entry with key 'sample_rate' to value '48000'
[abuffer @ 0x853e040] Setting entry with key 'sample_fmt' to value 's16'
[abuffer @ 0x853e040] Setting entry with key 'channel_layout' to value '0x3'
[graph 1 input from stream 0:1 @ 0x853dd40] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[aformat @ 0x853d8e0] Setting entry with key 'sample_fmts' to value 'flt'
[audio format for output stream 0:1 @ 0x853d840] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:1'
[auto-inserted resampler 0 @ 0x8514c60] chl:stereo fmt:s16 r:48000Hz -> chl:stereo fmt:flt r:48000Hz
[libvpx @ 0x853ed80] v1.1.0
[libvpx @ 0x853ed80] --extra-cflags=-fPIC --enable-pic --enable-shared
[libvpx @ 0x853ed80] vpx_codec_enc_cfg
[libvpx @ 0x853ed80] generic settings
  g_usage:                      0
  g_threads:                    0
  g_profile:                    0
  g_w:                          320
  g_h:                          240
  g_timebase:                   {1/30}
  g_error_resilient:            0
  g_pass:                       0
  g_lag_in_frames:              0
[libvpx @ 0x853ed80] rate control settings
  rc_dropframe_thresh:          0
  rc_resize_allowed:            0
  rc_resize_up_thresh:          60
  rc_resize_down_thresh:        30
  rc_end_usage:                 0
  rc_twopass_stats_in:          (nil)(0)
  rc_target_bitrate:            256
[libvpx @ 0x853ed80] quantizer settings
  rc_min_quantizer:             4
  rc_max_quantizer:             63
[libvpx @ 0x853ed80] bitrate tolerance
  rc_undershoot_pct:            100
  rc_overshoot_pct:             100
[libvpx @ 0x853ed80] decoder buffer model
  rc_buf_sz:                    6000
  rc_buf_initial_sz:            4000
  rc_buf_optimal_sz:            5000
[libvpx @ 0x853ed80] 2 pass rate control settings
  rc_2pass_vbr_bias_pct:        50
  rc_2pass_vbr_minsection_pct:  0
  rc_2pass_vbr_maxsection_pct:  400
[libvpx @ 0x853ed80] keyframing settings
  kf_mode:                      1
  kf_min_dist:                  0
  kf_max_dist:                  128
[libvpx @ 0x853ed80] 
[libvpx @ 0x853ed80] vpx_codec_enc_cfg
[libvpx @ 0x853ed80] generic settings
  g_usage:                      0
  g_threads:                    0
  g_profile:                    0
  g_w:                          720
  g_h:                          576
  g_timebase:                   {1/25}
  g_error_resilient:            0
  g_pass:                       0
  g_lag_in_frames:              25
[libvpx @ 0x853ed80] rate control settings
  rc_dropframe_thresh:          0
  rc_resize_allowed:            0
  rc_resize_up_thresh:          60
  rc_resize_down_thresh:        30
  rc_end_usage:                 0
  rc_twopass_stats_in:          (nil)(0)
  rc_target_bitrate:            200
[libvpx @ 0x853ed80] quantizer settings
  rc_min_quantizer:             4
  rc_max_quantizer:             63
[libvpx @ 0x853ed80] bitrate tolerance
  rc_undershoot_pct:            100
  rc_overshoot_pct:             100
[libvpx @ 0x853ed80] decoder buffer model
  rc_buf_sz:                    6000
  rc_buf_initial_sz:            4000
  rc_buf_optimal_sz:            5000
[libvpx @ 0x853ed80] 2 pass rate control settings
  rc_2pass_vbr_bias_pct:        50
  rc_2pass_vbr_minsection_pct:  0
  rc_2pass_vbr_maxsection_pct:  400
[libvpx @ 0x853ed80] keyframing settings
  kf_mode:                      1
  kf_min_dist:                  0
  kf_max_dist:                  128
[libvpx @ 0x853ed80] 
[libvpx @ 0x853ed80] vpx_codec_control
[libvpx @ 0x853ed80]   VP8E_SET_CPUUSED:             3
[libvpx @ 0x853ed80]   VP8E_SET_ARNR_MAXFRAMES:      0
[libvpx @ 0x853ed80]   VP8E_SET_ARNR_STRENGTH:       3
[libvpx @ 0x853ed80]   VP8E_SET_ARNR_TYPE:           3
[libvpx @ 0x853ed80]   VP8E_SET_NOISE_SENSITIVITY:   0
[libvpx @ 0x853ed80]   VP8E_SET_TOKEN_PARTITIONS:    0
[libvpx @ 0x853ed80]   VP8E_SET_STATIC_THRESHOLD:    0
[libvpx @ 0x853ed80]   VP8E_SET_CQ_LEVEL:            0
[libvpx @ 0x853ed80] Using deadline: 1000000
[mpeg4 @ 0x851cee0] detected 2 logical cores
Output #0, webm, to 'out_mp4-webm_setdaronly.webm':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf54.29.104
    Stream #0:0(und), 0, 1/1000: Video: vp8, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/25, q=-1--1, 200 kb/s, 1k tbn, 25 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und), 0, 1/1000: Audio: vorbis, 48000 Hz, stereo, flt
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> libvpx)
  Stream #0:1 -> #0:1 (aac -> libvorbis)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8516500] demuxer injecting skip 1024
[aac @ 0x851dbe0] skip 1024 samples due to side data
[aac @ 0x851dbe0] skip whole frame, skip left: 0
[libvorbis @ 0x852e420] Que input is backward in time
[webm @ 0x853e6c0] Writing block at offset 4481, size 35867, pts 0, dts 0, duration 40, flags 128
[webm @ 0x853e6c0] Writing block at offset 40356, size 40, pts 21, dts 21, duration 3, flags 128
[webm @ 0x853e6c0] Writing block at offset 40402, size 222, pts 24, dts 24, duration 12, flags 128
[webm @ 0x853e6c0] Writing block at offset 40631, size 208, pts 36, dts 36, duration 21, flags 128
...
-------------- next part --------------
/usr/local/bin/ffprobe -print_format json -show_format -show_streams out_mp4-webm_setdaronly.webm 
ffprobe version 1.0 Copyright (c) 2007-2012 the FFmpeg developers
  built on Dec  3 2012 17:02:53 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --prefix=/usr/local/ --enable-shared --enable-avfilter --enable-libvorbis --enable-pthreads --enable-libvpx --enable-gpl --enable-pic
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
{
Input #0, matroska,webm, from 'out_mp4-webm_setdaronly.webm':
  Duration: 00:00:11.33, start: 0.000000, bitrate: 273 kb/s
    Stream #0:0: Video: vp8, yuv420p, 720x576, SAR 212:199 DAR 265:199, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16 (default)
    "streams": [
        {
            "index": 0,
            "codec_name": "vp8",
            "codec_long_name": "On2 VP8",
            "codec_type": "video",
            "codec_time_base": "1/1000",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 720,
            "height": 576,
            "has_b_frames": 0,
            "sample_aspect_ratio": "212:199",
            "display_aspect_ratio": "265:199",
            "pix_fmt": "yuv420p",
            "level": -99,
            "r_frame_rate": "25/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000"
        },
        {
            "index": 1,
            "codec_name": "vorbis",
            "codec_long_name": "Vorbis",
            "codec_type": "audio",
            "codec_time_base": "1/48000",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "s16",
            "sample_rate": "48000",
            "channels": 2,
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000"
        }
    ],
    "format": {
        "filename": "out_mp4-webm_setdaronly.webm",
        "nb_streams": 2,
        "format_name": "matroska,webm",
        "format_long_name": "Matroska / WebM",
        "start_time": "0.000000",
        "duration": "11.332000",
        "size": "387786",
        "bit_rate": "273763"
    }
}


More information about the ffmpeg-user mailing list