[Cin] Set stream sample aspect ratio in ffmpeg.C

Andrew Randrianasulu randrianasulu at gmail.com
Sat Jan 6 01:35:41 CET 2024


сб, 6 янв. 2024 г., 03:24 Terje J. Hanssen <terjejhanssen at gmail.com>:

>
>
> Den 05.01.2024 16:19, skrev Terje J. Hanssen:
> >
> >
> > Den 05.01.2024 02:58, skrev Andrew Randrianasulu:
> >> On Fri, Jan 5, 2024 at 3:59 AM Andrew Randrianasulu
> >> <randrianasulu at gmail.com> wrote:
> >>>
> >>>
> >>> пт, 5 янв. 2024 г., 02:59 Andrew Randrianasulu
> >>> <randrianasulu at gmail.com>:
> >>>>
> >>>>
> >>>> пт, 5 янв. 2024 г., 02:53 Phyllis Smith <phylsmith2017 at gmail.com>:
> >>>>> Bummer, although this does fix the 1 problem as discovered by
> >>>>> Terje, it breaks Bluray and DVD creation.  You can easily see this
> >>>>> without having a bluray writer simply with these steps:
> >>>>> 1) load video with audio which in my case was 1440x1080 (from a
> >>>>> sony camera)
> >>>>> 2) pulldown Settings/Format and switch to HDV 1080/25
> >>>>> 3) pulldown File and select bd_render
> >>>>>
> >>>>> Error is:  FFMPEG::encode_activate: write header failed
> >>>>> /tmp/bd_20240104-164102/bd.m2ts
> >>>>>    err: Invalid argument
> >>>
> >>> To be honest it errs out for me even without my patch?
> >>>
> >>> FFMPEG::encode_activate: write header failed
> >>> /data/data/com.termux/files/home/tmp/bd_20240105-035457/bd.m2ts
> >>>    err: Math result not representable
> >>>
> >>> for 1440*1080 hdv sample without setting format first (it sets
> >>> itself on media autoload) and using default bd render params
> >>> (1440*1080, 25i)
> >>>
> >>>
> >>
> >> ah, it was due to using system (unpatched) ffmpeg!
> >>
> >> Try this series instead, it guards setting stream sample aspect ratio
> >> only to muxers supporting it
> >> (I grep in libavformat for sample_sapect)
> >>
> >> I tested avi, qt, y4m, matroska
> >>
> >>
> >>>>> In DVD creation, it does create the DVD without erring out, but
> >>>>> the DVD will not even load on an LG DVD/Bluray device hooked up to
> >>>>> the TV.  It plays on the Samsung UHD but hangs on 1 part towards
> >>>>> the end.
> >>>>
> >>>>
> >>>> So, I guess it should not be applied for at least m2ts and mpeg2
> >>>> containers ..... I'll try to limit it only to mov/mp4/mkv/webm .
> >>>>>
> >>>>> The patch probably has other unknown ramifications that I have not
> >>>>> found.  Neither HV or CV have an existing "ffmpeg.C" file in the
> >>>>> cinelerra subdirectory for comparison.
> >>>>>
> >>>>>
> >>>>> On Sat, Dec 30, 2023 at 10:31 AM Andrew Randrianasulu
> >>>>> <randrianasulu at gmail.com> wrote:
> >>>>>> Now it seems to display correct (16/9) DAR for sample encoded
> >>>>>> directly from hdv. (but for speed I tested vp8/webm, not av1/webm)
> >>>>>>
> >>>>>>
> >
> > I have not tested it and don't know how this works. But shouldn't it
> > in principle keep or preserve the HDV 1080i "anamorphic flag" so
> > players detect to stretch it horizontally to DAR 16:9?
> > This also due to the fact that the HDV videopart should be possible to
> > copy directly to BD without rendering (or similar if downscaling to a
> > DV(D) anamorphic widescreen format).
> >
>
> This technical primer is one of the better I've seen about  "Aspect
> Ratio and Digital Video". And I noted especially the last section "Best
> practices when working with anamorphic video"
> http://www.miraizon.com/support/info_aspectratio.html



yeah, thanks.

I think right now we have issues with ffmpeg internals (libavformat) not
quite happy with stream (container) level SAR being set ... it breaks our
custom dvd/bluray encoding, as discovered by Phyllis.

I am looking into this and audio bug but so far no solution for
either,sorry.

>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240106/d039ae64/attachment.htm>


More information about the Cin mailing list