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

Terje J. Hanssen terjejhanssen at gmail.com
Fri Jan 5 16:19:01 CET 2024



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).





More information about the Cin mailing list