X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmux%2Fmp4.c;h=d5a8614500094dde07a50c708cab0db391e812e6;hb=ce56b26e1e1f824d0ad975680af66e2f22df7cb2;hp=bfd9866c58d192afc7a80fdc62b8e981ee7d54f8;hpb=17b5ee09d8f74c1e0a7d1d6c1610b6078075ac3b;p=vlc diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c index bfd9866c58..d5a8614500 100644 --- a/modules/mux/mp4.c +++ b/modules/mux/mp4.c @@ -1632,11 +1632,12 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux ) else if( p_stream->fmt.i_cat == VIDEO_ES ) { int i_width = p_stream->fmt.video.i_width << 16; - if( p_stream->fmt.video.i_aspect > 0 ) + if( p_stream->fmt.video.i_sar_num > 0 && + p_stream->fmt.video.i_sar_den > 0 ) { - i_width = (int64_t)p_stream->fmt.video.i_aspect * - ((int64_t)p_stream->fmt.video.i_height << 16) / - VOUT_ASPECT_FACTOR; + i_width = (int64_t)p_stream->fmt.video.i_sar_num * + ((int64_t)p_stream->fmt.video.i_width << 16) / + p_stream->fmt.video.i_sar_den; } // width (presentation) bo_add_32be( tkhd, i_width ); @@ -1653,12 +1654,14 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux ) mp4_stream_t *tk = p_sys->pp_streams[i]; if( tk->fmt.i_cat == VIDEO_ES ) { - if( p_stream->fmt.video.i_aspect ) - i_width = (int64_t)p_stream->fmt.video.i_aspect * - ((int64_t)p_stream->fmt.video.i_height<<16) / VOUT_ASPECT_FACTOR; + if( tk->fmt.video.i_sar_num > 0 && + tk->fmt.video.i_sar_den > 0 ) + i_width = (int64_t)tk->fmt.video.i_sar_num * + ((int64_t)tk->fmt.video.i_width << 16) / + tk->fmt.video.i_sar_den; else - i_width = p_stream->fmt.video.i_width << 16; - i_height = p_stream->fmt.video.i_height; + i_width = tk->fmt.video.i_width << 16; + i_height = tk->fmt.video.i_height; break; } }