i have video 1920x1040 but can't play on my TV (out 1920x1080). this video have AVC codec high profile, try to reduce profile with tsMuxer but not work.
so, i need to re-encode my video. libx264 is better but more slow: for 2 hour video, need 70 minute to conversion!
then i need to re-encode with mpeg4 (with high bitrate result is satisfying). i want scale video to reduce my time encoding. then i have used this command:
but with this code my TV enlarge image to my screen. i need to add -vf pad but i can't find the right proportions on:Code:ffmpeg -i video.mp4 -acodec copy -c:v:0 mpeg4 -b:v:0 2000k -s 960x432 -y video2.mp4
tanxs to all for help.Code:-vf pad=960:xxx:0:xx
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 32
Thread
-
-
In AviSynth you could use the AddBorders() function...
This answer on StackOverflow might help you. -
i've solved with 2 step:
first scale video -s 960x432
second add pad only (found correct value!) with -vf pad=960:540:0:54
but how to have everything in one step? -
yes. tanxs jagabo
anyway another way is:
Code:ffmpeg -i video.mp4 -c:a copy -c:v:0 mpeg4 -b:v:0 2400k -crf 23 -filter:v:0 "crop=1920:824:0:108,scale=960:432" -t 01:56:00.000 -y vid-007.mp4
Last edited by lomero; 15th Sep 2021 at 12:37.
-
edit: @jagabo
your code not work properly. my TV always adapt the image to its output...
no black borders above and belowLast edited by lomero; 15th Sep 2021 at 13:55.
-
The filter sequence I gave added black borders to the top and bottom of the 1920x1040 source to create a letterboxed 1920x1080 frame (standard 16:9 frame size). Then it resized to 960x540, 1/2 on each dimension so the aspect ratio is retained. So there are black borders in the the final video. They may be small enough that they are hidden by the TV's overscan.
The filter sequence you gave doesn't really make sense. First of all, you're cropping the 1920x1040 source video to 1920x824. Why? Does the source already have black borders? If so you should have seen them on your TV when playing the original video. If not you are removing part of the picture. After that you resize the 1920x824 frame to 960x432. That will distort the video a little. If the original was square pixel you should have resized to 960x412 to retain the aspect ratio. And if your TV always stretches the video to full screen you should not have seen any borders.
You should post a small sample of your source (without re-encoding) so we can see exactly what you have. -
maybe your speech is correct, but in the end with your code on my TV i do not have black borders, with my code work fine.
i have find this solution with help ffmpegyag app. put my resolution and add black borders to window app, save script and i see correct code for my question.
here small sample source (without re-encoding): https://www.upload.ee/files/13475461/Joker_2.mp4.html -
This works here:
Code:-c:v libx264 -crf 20 -vf "pad=1920:1080:0:20, scale=960:540" -c:a copy
Last edited by Sharc; 16th Sep 2021 at 03:24.
-
with libx264 work also without -vf pad
but i need re-encode with mpeg4 (see my first post) and your code with mpeg4 not work. -
That movie was shot at 1.85:1. It's supposed to have very small borders at the top and bottom, about 20 lines each, when viewed on a 16:9 TV. Turn off the overscan on your TV so you can see the small letterbox bars with my filter sequence.
Your sequence is throwing away 20 percent of the picture at the top and bottom and turning it into a 2.35:1 movie. That's not the way the movie was meant to be watched.Last edited by jagabo; 15th Sep 2021 at 18:41.
-
Works perfectly with mpeg4 codec as well.
Code:-c:v mpeg4 -b:v 5000k -vf "pad=1920:1080:0:20, scale=960:540" -c:a copy
[Attachment 60749 - Click to enlarge] -
i don't know.
maybe it's a problem to my TV, but tanxs Sharc but i don't have borders on my TV screen...
and yes jagabo, you'r right: original is 1920x1040. my resolution is 960x432 i don't really remember why i chose this resolution... but in the endless tests i did, I looked at some sequences of the video well in detail, i can change the resolution of the video, but the center of the speech are the black bands on the sides.
and i don't even understand why your code on my TV doesn't work. but this is.
another question: crf factor is prerogative only for libx264 or also mpeg4? i see on Sharc code:
Code:-c:v libx264 -crf 20
Code:-c:v mpeg4 -b:v 5000k
-
I don't think that the mpeg4 Visual has an CRF equivalent for rate control. The closest would probably be encoding with a fixed quantizer, but I didn't try and perhaps someone more knowledgable will chime in.
You could check the available options with
Code:ffmpeg.exe -h encoder=mpeg4
-
as already mentioned in my first post, i know that libx264 is better and more efficient, but a 2-hour video like mine, it takes a time of 60-70 minutes for encoding (speed 1.8x)
with mpeg4 codec same video required 20 minute to encode (speed 5-6x) and the difference (on my little TV) it's not so much as to justify a time of 3 times as much for encoding.
for only reason i preferred re-encode my video with mpeg4. -
Look up how to turn off the overscan feature on your TV. That will allow you to see the entire picture.
The constant quantizer setting for the mpeg4 encoder in ffmpeg is "-c:v mpeg4 -qscale:v 3".
For faster encoding with libx264 try specifying the veryfast of superfast preset "-c:v libx264 -preset veryfast -crf 20". The quality will be less than the default (-preset medium) but it will still be better than the mpeg4 encoder at the similar bitrates. -
In case you don't know what overscan is:
https://www.howtogeek.com/252193/hdtv-overscan-what-it-is-and-why-you-should-probably-turn-it-off/
Most TVs do it by default and have a way of disabling it. Turning it off will give you a sharper picture and let you see the entire picture. Attached is a sample video that lets you check for overscan. With overscan disabled you should see a picture like:
[Attachment 60753 - Click to enlarge]
On a 1080p monitor you should see all the way to edges of picture and there shouldn't be any distortion in the middle of the picture.
With no overscan you should be able to see all of the gauges at the edges of the frame:
[Attachment 60754 - Click to enlarge]
With overscan part of the edges will be cut off:
[Attachment 60758 - Click to enlarge]
The center of the image should have clear alternating dark/bright lines:
[Attachment 60756 - Click to enlarge]
Not distortions like:
[Attachment 60757 - Click to enlarge]
On a 720p monitor you will see distortions in the middle but you should still be able to see all of all four gauges.Last edited by jagabo; 16th Sep 2021 at 18:51.
-
with your advice, i've search overscan first on web, and after on my TV.
on my TV i don't have the chance to turn off overscan, but i have 4 choices: automatic, 16/9, 4:3LB, 4:3PS
with this video, if put auto or 16/9 i don't have black borders and image is adapted on my screen.
but if i set overscan 4:3LB i see correct image with borders and right AR!
but this rule is not always valid: with another video, 1696x720, 4:3LB setting not work, but i need put on 16/9 or auto to have right image out on my TV.
probably changes the ratio and then has to change the output: while before it was 1920x1040 (AR 1.85) now here is 1696x720 (AR 2.35) and then you have to change TV output.
thanks to your advice, jagabo, tried the various outputs, i found the correct one for my TV! Thank you. -
Nice test video, thank you.
As a sidenote, just in case: The video did not play here on my TV because it has Profile "High@L5". Remuxing it (e.g. with tsmuxer) and changing to Profile to "High@L4.1" solved the problem. In worst case one may have to re-encode it with more relaxed settings, depending on player capability.Last edited by Sharc; 17th Sep 2021 at 14:30.
-
Oh, I didn't notice the Profile@Level. I just used a batch file on my desktop to do the encoding and didn't think about that.
-
You don't need to change if if your player can play it. But here's a new one that High@4.0.
-
-
anyway this is mediainfo report to this my video that not play on my TV:
HTML Code:General Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 1.07 GiB Duration : 2 h 1 min Overall bit rate : 1 258 kb/s Writing application : Lavf58.29.100 Video Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 2 h 1 min Bit rate : 1 126 kb/s Width : 1 920 pixels Height : 1 040 pixels Display aspect ratio : 1.85:1 Frame rate mode : Constant Frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.024 Stream size : 981 MiB (90%) Writing library : x264 core 157 r2969 d4099dd Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=32 / lookahead_threads=5 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=1200 / vbv_bufsize=2048 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 Tagged date : UTC 2019-12-18 02:55:56 Codec configuration box : avcC
HTML Code:General Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 630 MiB Duration : 1 h 58 min Overall bit rate : 742 kb/s Writing application : Lavf58.29.100 Video Format : AVC Format/Info : Advanced Video Codec Format profile : High@L3 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 1 h 58 min Source duration : 4 min 17 s Bit rate : 609 kb/s Width : 720 pixels Height : 304 pixels Display aspect ratio : 2.35:1 Frame rate mode : Constant Frame rate : 23.976 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.116 Stream size : 518 MiB (82%) Source stream size : 518 MiB (82%) Writing library : x264 core 157 r2969 d4099dd Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=9 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=20 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=1200 / vbv_bufsize=2048 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 Tagged date : UTC 2019-12-31 12:07:49 mdhd_Duration : 7129909 Codec configuration box : avcC
HTML Code:General Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 598 MiB Duration : 54 min 14 s Overall bit rate mode : Variable Overall bit rate : 1 541 kb/s Writing application : Lavf58.45.100 Cover : Yes Part_ID : 1 Video Format : AVC Format/Info : Advanced Video Codec Format profile : High@L3.1 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 54 min 13 s Bit rate mode : Variable Bit rate : 1 408 kb/s Maximum bit rate : 14.0 Mb/s Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.061 Stream size : 546 MiB (91%) Title : 264:moovts=-1:fps=25:deps:par=auto@GPAC1.1.0-DEV-rev5187-g1ffb067d9-HEAD Writing library : x264 core 148 r2722 1b0121b Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x111 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=120 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / stitchable=1 / constrained_intra=0 / bframes=16 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=126 / scenecut=0 / intra_refresh=0 / rc_lookahead=250 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.50 / qpmin=6 / qpmax=51 / qpstep=4 / vbv_maxrate=14000 / vbv_bufsize=14000 / crf_max=0.0 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:0.80 Codec configuration box : avcC
all video use codec libx264 with High Profile Level. what differences? and why don't i see the first two while I see the last video well? -
Maybe your TV player only plays standard resolutions like 1920x1080, 1280x720, 1440x1080, 720x480, 720x576
Your 3 examples
- the first is 1920x1040 = non standard, no play
- the second is 720x304 = non standard, no play
- the third is 1280x720 = standard, play
Can you play jagabo's test clip? -
yes, your version work for me.
[Attachment 60793 - Click to enlarge]
and then?
Similar Threads
-
add pad ffmpeg
By lomero in forum EditingReplies: 0Last Post: 15th Sep 2021, 03:29 -
NCH Video pad keeps failing
By Ironside in forum Newbie / General discussionsReplies: 16Last Post: 27th Aug 2021, 08:33 -
how do i add libx264 and hevc to ffmpeg when i compile ffmpeg for ubuntu 21
By oduodui in forum Newbie / General discussionsReplies: 2Last Post: 17th Jul 2021, 05:12 -
Pad audio end needed
By Budman1 in forum Video ConversionReplies: 4Last Post: 9th Feb 2020, 02:42 -
Crop and Pad a Blu Ray rip?
By jcwillia1 in forum Blu-ray RippingReplies: 4Last Post: 31st May 2018, 09:02