Hello I'm trying to merge to videoes with different resolution (1.280x720 vs 640x360 pixels), CRF (constant rate factor: 20 vs 25) and bitrates (average and maximum). I succedeed using Shotcut as converting tool for the first video and MKVToolNix to join the two videoes (the first converted and the second 'original'). I was wondering why using ffmpeg + MKVToolNix the second part of the video (the one not converted) comes pixelated.
I used the exact commands I used for Shotcut to convert the first video:
This video comes well, but when I join it to the other video the output is pixalated.Code:ffmpeg -threads 0 -i input.mp4 -vf scale=640:360 -sws_flags bilinear -c:v libx264 -b:v 300k -bufsize 2500k -crf 25 -g 125 -bf 3 -c:a aac -ar 44100 -b:a 128k output.mp4
Here are ShotCut commands that succedeed.
[Attachment 58347 - Click to enlarge]
I attach the parameters of the first video (the one to be converted) and the second video.
Code:General Complete name : C:\Users\parvares\Desktop\input.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 424 MiB Duration : 38 min 21 s Overall bit rate : 1 545 kb/s Writing application : Lavf58.64.100 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@Level3.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 : 38 min 21 s Bit rate : 1 410 kb/s Maximum bit rate : 1 680 kb/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 : 387 MiB (91%) Writing library : x264 core 161 r3027 4121277 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=12 / 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=125 / scenecut=40 / intra_refresh=0 / rc_lookahead=125 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=1680 / vbv_bufsize=8400 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 Codec configuration box : avcC Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 38 min 21 s Bit rate mode : Constant Bit rate : 129 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 35.3 MiB (8%) Default : Yes Alternate group : 1
Code:General Complete name : C:\Users\parvares\Desktop\1.2.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 125 MiB Duration : 40 min 1 s Overall bit rate : 435 kb/s Writing application : Lavf58.64.100 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@Level3 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 : 40 min 1 s Bit rate : 300 kb/s Maximum bit rate : 2 500 kb/s Width : 640 pixels Height : 360 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.052 Stream size : 85.8 MiB (69%) Writing library : x264 core 161 r3027 4121277 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=11 / lookahead_threads=1 / 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=125 / keyint_min=12 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=25.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=2500 / vbv_bufsize=12500 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 Codec configuration box : avcC Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 40 min 1 s Bit rate mode : Constant Bit rate : 129 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 44.1 kHz Frame rate : 43.066 FPS (1024 SPF) Compression mode : Lossy Stream size : 36.8 MiB (30%) Default : Yes Alternate group : 1
Thank you!
+ Reply to Thread
Results 1 to 4 of 4
-
Last edited by parvares; 12th Apr 2021 at 03:19.
-
Looking at the 640x480 file info:
Code: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=11 / lookahead_threads=1 / 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=125 / keyint_min=12 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=25.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=2500 / vbv_bufsize=12500 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Code:ffmpeg -threads 0 -i input.mp4 -vf scale=640:360 -sws_flags bilinear -c:v libx264 -b:v 300k -bufsize 2500k -crf 25 -g 125 -bf 3 -c:a aac -ar 44100 -b:a 128k output.mp4
Settings like profile, level, vbv, b-pyramid, weight-p, ref count, b-frame count, open-gop, interlaced, mb-tree need to match up.
(https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping might help a bit)
I'm surprised MKVToolnix doesn't ad least report some warning while appending the files,...
Cu Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
Thank you Jagabo, thanks Cu Selur, you were right, I had to add a parameter:
Code:-preset fast
--rc-lookahead 30 --ref 2 --subme 6
Code:ffmpeg -i input.mp4 -vf scale=640:360 -c:v libx264 -preset fast -crf 25 -ar 44100 output.mp4
Now there is no problem joining the videoes.
MKVToolNix didn't help me with this generic warning:
The codec's private data does not match. Both have the same length (50) but different content. Please make sure that the resulting file plays correctly the whole time. The author of this program will probably not give support for playback issues with the resulting file.Last edited by parvares; 16th Apr 2021 at 01:52.
Similar Threads
-
batch merge videos and audios with ffmpeg
By m0ck in forum Video ConversionReplies: 6Last Post: 27th May 2021, 08:12 -
[solved] Convert video changing Scale and Bitrates - Ffmpeg
By parvares in forum Newbie / General discussionsReplies: 10Last Post: 8th Apr 2021, 17:35 -
[FFMPEG] How to merge flac and image to mkv (Wrong Color)
By Anonymous20 in forum Video ConversionReplies: 2Last Post: 7th Feb 2019, 09:34 -
FFMPEG how to merge 2 stereo .wav audio files into one of 4 channels?
By marcorocchini in forum Newbie / General discussionsReplies: 4Last Post: 24th Jun 2018, 07:25 -
ffmpeg scaling video resolution
By marcorocchini in forum Newbie / General discussionsReplies: 7Last Post: 26th Feb 2017, 09:25