Zhang Weiwu wrote:
Thanks for sharing insights.

On Sat, 19 Jul 2014, David Favor wrote:

what I do now if forcibly clear it... or better said remove it from the container, so the video playback code discovers the true numbers from the actual video stream.

Not sure if I got you. I think you meant:

stripping off SAR/DAR info from container so that players uses SAR/DAR info stored in the stream.

In that case you mean SAR/DAR info are stored twice in a file, correct?

No. As best I understand there is a default SAR/DAR for the container + each
video stream. All this approach does is remove the container SAR/DAR, so
SAR/DAR is taken from whatever video stream is selected (by player).

I further deduce: in case of the file I produced:

Stream #0:2(und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x496
[SAR 1:1 DAR 40:31], 1708 kb/s, SAR 4:3 DAR 160:93, 25 fps, 25 tbr

[SAR 1:1 DAR 40:31] means the SAR/DAR in the video stream
 SAR 4:3 DAR 160:93 means the SAR/DAR in the container

If this deduction is correct, then stripping off the container's DAR/SAR info would not help my case, because the original file I wish to fix does not have DAR/SAR info in the container to start with at all. Check my original post:
Original video that I want to fix:

Stream #0:2(und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x496
[SAR 1:1 DAR 40:31], 1708 kb/s, 25 fps, 25 tbr, 12800 tbn, 30k tbc

See: no SAR/DAR info after [SAR...DAR].

You suggested this command to fix:
  ffmpeg -i in [AAC acodec cruft + H264 vcodec cruft] \
            -vf setdar=dar=0,setsar=sar=0 \
-x264opts colorprim=bt709:transfer=bt709:colormatrix=bt709:fullrange=off

I am pretty sure it won't work, because:
1) my buggy files are mpeg4 vcodec, thus -x264opts mustn't work for it.

Upgrade your x264. Handling various buggy files has been fixed for a very
long time.

2) the container has no SAR/DAR info at all, it is the SAR/DAR info in the video stream that is wrong needing a fix.

To effect container SAR/DAR video must be re-encoded, so as a side effect
whatever code you're using (libav/ffmpeg) will rediscover/recompute SAR/DAR
from the video stream, the filter above strips SAR/DAR from container by
forcing both to zero, then SAR/DAR is recomputed from video stream.

I'd suggest you just try this once.

Keep in mind, if your video stream really does have a 4:3.1 aspect ratio,
then your output video will also.

To effect the SAR/DAR of the actual video stream, you'll have to use a filter
to crop your video from 4:3.1 to 4:3... so 640×480 is real 4:3 + your video
is 640x496 which is 4:3.1 or 4:3.2 so you'll have to do either cropping or
scaling, so with latest ffmpeg, you'd add...

    -vf setdar=dar=0,setsar=sar=0,scale=320:240

I'd first try just...

    -vf scale=320:240

As rescaling will likely reset or strip container SAR/DAR. I just always
strip container SAR/DAR as a matter of habit now.


_______________________________________________
libav-tools mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-tools

Reply via email to