[FFmpeg-user] ffmpeg with x264 codec - Aspect ratio doesn't follow input

Richard F lists at keynet-technology.com
Wed May 25 16:17:18 CEST 2016


OK, so this comes up every so often - I found similar refs on list archives
A useful keyword seems to be WSS "wide screen switching" from the old
analogue days
https://en.wikipedia.org/wiki/Widescreen_signaling

http://ffmpeg-users.933282.n4.nabble.com/Aspect-ratio-td3255527.html
http://ffmpeg-users.933282.n4.nabble.com/template/NamlServlet.jtp?macro=search_page&node=933282&query=wss
https://www.mail-archive.com/search?l=ffmpeg-issues@lscube.org&q=subject:%22%5C%5Bissue2255%5C%5D+ffmpeg+h264+wss%22&o=newest&f=1

I'm surprised it's not in the tree - it's an obvious requirement
(and ffmpeg's native MP4 encoder does it out of the box...)

I'd like to make a feature request - it seems a lot of the work is
already done - how to do?

Thanks


On 25/05/2016 14:33, chronek wrote:
> I doubt that it reach any release, but you can build own ffmpeg with
> their patch proposed
>
> W dniu 2016-05-25 o 15:04, Richard F pisze:
>> Yes - that's the exact issue - multiple aspect ratio changes, and I'm
>> not sure how to find where they occur without a lot of complexity
>> About 7 years ago Jarmo Torvinen proposed something to address this
>> exact issue - did this ever reach the build, if so how to activate ?
>> http://x264-devel.videolan.narkive.com/TlgcMaKZ/reconfiguring-x264-aspect-ratio-in-the-middle-of-stream
>>
>>
>>
>> On 25/05/2016 13:53, chronek wrote:
>>> Didnt read to end before, are you have 2 aspect ratio in stream? Then
>>> you need split and process each part alone...
>>>
>>> W dniu 2016-05-25 o 11:18, Richard F pisze:
>>>> Thanks for your reply,
>>>>
>>>> The stream info for this file is as follows. As you can see the DAR
>>>> starts as 16:9, but the aspect changes several times during the
>>>> recording, x264 doesn't follow the changes, stays at 16:9.
>>>>
>>>> If I force the SAR as you suggest the output is narrower than 4:3 and
>>>> still doesn't change with incoming aspect changes.
>>>>
>>>> Input #0, mpegts, from '00001.ts':
>>>>     Duration: 00:59:49.47, start: 4529.649200, bitrate: 1477 kb/s
>>>>     Program 132
>>>>       Stream #0:0[0x18a1]: Video: mpeg2video (Main) ([2][0][0][0] /
>>>> 0x0002), yuv420p(tv), 544x576 [SAR 32:17 DAR 16:9], max. 15000
>>>> kb/s, 25
>>>> fps, 25 tbr, 90k tbn, 50 tbc
>>>>       Stream #0:1[0x18a2](eng): Audio: mp2 ([3][0][0][0] / 0x0003),
>>>> 48000
>>>> Hz, stereo, s16p, 128 kb/s
>>>>       Stream #0:2[0x18a3](eng): Audio: mp3 ([3][0][0][0] / 0x0003), 0
>>>> channels, s16p
>>>>       Stream #0:3[0x18a6](eng): Subtitle: dvb_subtitle ([6][0][0][0] /
>>>> 0x0006)
>>>>
>>>> If I analyse the stream 5 minutes into the programme, like so:
>>>> ffmpeg -loglevel quiet -ss 00:05:00 -i "00001.ts" -t 10 -c copy
>>>> -avoid_negative_ts 1 -f nut pipe:1 | ffmpeg -hide_banner -i pipe:0
>>>>
>>>> Then the video stream is as follows:
>>>>
>>>> Stream #0:0: Video: mpeg2video (Main) (mpg2 / 0x3267706D),
>>>> yuv420p(tv),
>>>> 544x576 [SAR 24:17 DAR 4:3], max. 15000 kb/s, SAR 32:17 DAR 16:9, 25
>>>> fps, 25 tbr, 90k tbn, 50 tbc
>>>>
>>>> So it is meant to show as 4:3 here.
>>>> I'm assuming the 2 sets of SAR/DAR are for container and stream
>>>> which is
>>>> why it still shows as 16:9 after ffmpeg processing ?
>>>>
>>>>
>>>>
>>>> On 25/05/2016 08:10, chronek wrote:
>>>>> Maybe your source not have sar 1:1... setdar will not change
>>>>> resolution, it will change only information about aspectratio and
>>>>> some
>>>>> players not read desired aspect ratio... Best try change to
>>>>> resolution
>>>>> what yuou want and setsar for it... ( -vf scale=x:y,setsar=1 )
>>>>>
>>>>> W dniu 2016-05-25 o 09:00, Richard F pisze:
>>>>>> Hi list,
>>>>>>
>>>>>> I have a number of MPEG2 TS DVB recordings that have aspect ratio
>>>>>> changes - e.g. older films or 4:3 programmes that have 16:9
>>>>>> continuity, trailers, adverts etc.
>>>>>>
>>>>>> I want to transcode to H264 using ffmpeg (3.02), but the output
>>>>>> aspect ratio does not follow the source when using the H264 codec.
>>>>>> But the aspect ratio does follow when using the xvid/mp4 codec.
>>>>>> I need x264 not mp4.
>>>>>> The problem is that (I think) the container DAR or SAR stays at 16:9
>>>>>> all the way through but the stream SAR or DAR doesn't follow the
>>>>>> source for whatever reason
>>>>>>
>>>>>> Is there a way to make x264 output follow the source aspect ratio at
>>>>>> the stream level ?
>>>>>>
>>>>>> Failing example :
>>>>>> ffmpeg -y -i 00001.ts -map 0:0 -map 0:1 -map 0:3 -c:v libx264
>>>>>> -preset
>>>>>> veryfast -profile:v high -level 4.0 -crf 20 -flags +loop -flags
>>>>>> +ilme
>>>>>> -vf yadif=0:-1:0 -c:a:0 aac -b:a:0 128k -c:s copy -f mpegts
>>>>>> file-1.ts
>>>>>> (same if I take out the profile and deinterlace settings)
>>>>>>
>>>>>> Working example (but large file and not so good quality, even if I
>>>>>> could use it):
>>>>>> ffmpeg -y -i 00001.ts -map 0:0 -map 0:1 -map 0:3 -c:v libxvid -q:v 3
>>>>>> -c:a:0 aac -b:a:0 128k -c:s copy -f mpegts file-1.ts
>>>>>>
>>>>>> If I add -vf setdar=dar=4/3, I can force the x264 version to be 4/3
>>>>>> but then all parts of the recording are always 4/3 which is also
>>>>>> wrong.
>>>>>>
>>>>>> Behaviour is the same on VLC player, ffplay, and Kodi.
>>>>>>
>>>>>> Appreciate any pointers
>>>>>> Thanks
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> ffmpeg-user mailing list
>>>>>> ffmpeg-user at ffmpeg.org
>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>>>
>>>>>> To unsubscribe, visit link above, or email
>>>>>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>>>>> _______________________________________________
>>>>> ffmpeg-user mailing list
>>>>> ffmpeg-user at ffmpeg.org
>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>>
>>>>> To unsubscribe, visit link above, or email
>>>>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>>>> _______________________________________________
>>>> ffmpeg-user mailing list
>>>> ffmpeg-user at ffmpeg.org
>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>>> To unsubscribe, visit link above, or email
>>>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>>> _______________________________________________
>>> ffmpeg-user mailing list
>>> ffmpeg-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".




More information about the ffmpeg-user mailing list