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

Andrew Randrianasulu randrianasulu at gmail.com
Fri Jan 5 02:58:14 CET 2024


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)
>>>>
>>>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Set-also-sample-aspect-ratio-for-encoded-ffmpeg-stre.patch
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240105/41dedaa8/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Guard-ffmpeg.C-stream-sample-aspect-ratio-only-for-f.patch
Type: text/x-patch
Size: 1259 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240105/41dedaa8/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-fix-guard-for-stream-sample-aspect-ratio-for-more-fm.patch
Type: text/x-patch
Size: 1389 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240105/41dedaa8/attachment-0005.patch>


More information about the Cin mailing list