I developed an sass function (written in scss) that produces a calc function that changes distance linearly between two given points. This is useful if I want a distance to change smoothly between two breakpoints. The function looks like this and is made to only support pixel values:
#function resp-px($point-a, $point-b){
// Example input: ( "desktop": 50, "tablet": 20 ) produces these values for our variables:
$devices: (
"desktop": 1920,
"laptop": 1280,
"tablet": 1000,
"mobile": 750,
);
$a-width: if(
is-device(first-key-in-map($point-a)),
map-get($devices, first-key-in-map($point-a)) / 100,
first-key-in-map($point-a) / 100
);
$a-pixels: first-value-in-map($point-a);
$b-width: if(
is-device(first-key-in-map($point-b)),
map-get($devices, first-key-in-map($point-b)) / 100,
first-key-in-map($point-b) / 100
);
$b-pixels: first-value-in-map($point-b);
// The example input produces these values for our variables:
// $a-width = 19.2, $a-pixels = 50, $b-width = 12.8, $b-pixels = 20
// We have a system of equations with 2 unknowns: { 19.2a + b = 50, 12.8a + b = 20 }
// Solution step by step:
// a = (50 - b)/19.2
// b = 20 - 12.8a => 20 - 12.8((50 - b)/19.2) = 20 - 12.8(50/19.2 - b/19.2) =
// = 20 - ((50 * 12.8) / 19.2 - (b * 12.8) / 19.2) = 20 - (50 * 12.8 / 19.2 - b * 12.8 / 19.2) =
// = 20 - 50 * 12.8 / 19.2 + b * 12.8 / 19.2
// => b - b * 12.8 / 19.2 = 20 - 50 * 12.8 / 19.2
// => (b - b * 12.8 / 19.2) * (1 / (1 - 12.8 / 19.2) = (20 - 50 * 12.8 / 19.2) * (1 / (1 - 12.8 / 19.2)
// => b = (20 - 50 * 12.8 / 19.2) * (1 / (1 - 12.8 / 19.2)
// && a = (50 - b)/19.2
$m: ($b-pixels - $a-pixels * $b-width / $a-width) * (1 / (1 - $b-width / $a-width));
$k: ($a-pixels - $m)/$a-width;
#return calc(#{$k}vw + #{$m}px);
}
Now, however, I want to support percentage values for the distance as well. BUT... I cannot wrap my head around how this can be done. Anyone got a solution? Can be a separate function as well if it makes it easier (named "resp-percentage" for example).
Tried including $b-pixels / 100 and $a-pixels / 100 in the equation but didn't get a solution.
Let me start of by saying that this issue presents itself on a Android headset, while running a Unity app with unity video player component that plays a video on it at 2 times the speed. Hence, the issue might be related to these components and not the video file itself.
I have a library of video files with properties as I will describe further down this post.
When I play these files at 2x the speed , the become extremelly jumpy to the point they can't be watched.
I've played with configurations such as : min-keyint=30:keyint=30:scenecut=0:open-gop=0:lossless=1 but I have to be honest and state that I have almost no clue as to what they do. I've read the documentation and understand gop, I-Frames , and the need to exist reference frames for fast seek, and almost for sure Fast playing of the file (?! maybe not?) , but don't know how to fine tune this.
Maybe I'm missing out something completely and/or someone as any advice as to what I could try?
The goal is to play these files at 2x its speed, or possibly faster.
Now for the details on the mpeg4 files:
Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main#L5#Main
Codec ID : hev1
Codec ID/Info : High Efficiency Video Coding
Duration : 15 min 0 s
Bit rate : 6 578 kb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0 (Type 0)
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.026
Stream size : 706 MiB (98%)
Writing library : x265 3.5+37-07b011400:[Windows][GCC 11.2.0][64 bit] 8bit+10bit+12bit
Encoding settings : cpuid=1111039 / frame-threads=3 / numa-pools=8 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x2160 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=20.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass
Language : English
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Codec configuration box : hvcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 15 min 0 s
Source duration : 15 min 0 s
Source_Duration_LastFrame : -12 ms
Bit rate mode : Constant
Bit rate : 128 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 : 13.8 MiB (2%)
Source stream size : 13.8 MiB (2%)
Default : Yes
Alternate group : 1
mdhd_Duration : 900233
I'm trying to get a 10-inch touch display (native resolution: 1280x800) to switch to 1024x768, but everything I try is either ignored or results in an error. The display reportedly supports the resolution, though, xrandr --verbose reports (I'm using the default VESA driver):
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 640 x 480, maximum 1280 x 800
default connected 640x480+0+0 (0x180) normal (normal) 0mm x 0mm
Identifier: 0x17d
Timestamp: 635022581
Subpixel: horizontal rgb
Clones:
CRTC: 0
CRTCs: 0
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
1280x800 (0x17e) 0.0MHz
h: width 1280 start 0 end 0 total 1280 skew 0 clock 0.0KHz
v: height 800 start 0 end 0 total 800 clock 0.0Hz
800x600 (0x17f) 0.0MHz
h: width 800 start 0 end 0 total 800 skew 0 clock 0.0KHz
v: height 600 start 0 end 0 total 600 clock 0.0Hz
640x480 (0x180) 0.0MHz *current
h: width 640 start 0 end 0 total 640 skew 0 clock 0.0KHz
v: height 480 start 0 end 0 total 480 clock 0.0Hz
1024x768 (0x181) 0.0MHz
h: width 1024 start 0 end 0 total 1024 skew 0 clock 0.0KHz
v: height 768 start 0 end 0 total 768 clock 0.0Hz
If I try to change the resolution via xrandr --output default --mode 1027x768, i just get:
xrandr: Failed to get size of gamma for output default
xrandr: Configure crtc 0 failed
As far as I can see, only the second line is relevant to my problem; I don't know why xrandr would want to configre crtc 0, though, I only have the touch screen connected.
Failing that, I tried to configure the mode directly using the following xorg.conf:
Section "InputClass"
Identifier "calibration"
MatchProduct "DIALOGUE INC PenMount USB"
Option "Calibration" "95 911 93 919"
Option "SwapAxes" "0"
EndSection
Section "Monitor"
Identifier "disp0"
Modeline "1024x768_60.00" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
Option "PreferredMode" "1024x768_60.00"
EndSection
Section "Device"
Identifier "card0"
Driver "vesa"
EndSection
Section "Screen"
Identifier "src0"
Device "card0"
Monitor "disp0"
SubSection "Display"
Modes "1024x768_60.00" "1024x768"
EndSubSection
EndSection
Unfortunately, This doesn't work, either Xorg.log shows the following:
[634043.694] (II) VESA(0): Not using mode "1024x768_60.00" (no mode of this name)
[634043.694] (II) VESA(0): Not using built-in mode "1024x768" (no mode of this name)
Why doesn't this work? And what else can I try to get the display to switch to 1024x768?
I've uploaded the full logfile to Pastebin.
You can try to perform the following actions
cvt -r 1024 768
xrandr --newmode "1024x768_60.00" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
xrandr --addmode default 1024x768_60.00
xrandr --output default --mode 1024x768_60.00
I want to convert a bunch of videos from x264 to x265, but I need to do so with ffmpeg in terminal because it's a remote server. These are my Handbrake options (listed items are ticked):
Summary tab
Web optimized
Align A/V Start
Dimensions tab unchanged
Filters tab
Sharpen - LapSharp, preset: Medium
Video tab
Video codec - H.265 (x265)
Framerate (FPS) - 30 - Peak Framerate
Quality - Constant Quality - 28
Encoder preset - Medium
Encoder tune - None
Encoder profile - Auto
Audio tab
Audio track - AAC, bitrate: 128
Subtitles tab - No subtitles (remove if exists)
This is the ffmpeg command that I've managed to compile so far:
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -c:a aac -b:a 128k -max_muxing_queue_size 400 -movflags +faststart output.mp4
I have the following two questions:
Does the ffmpeg command provided list all the options except the peak framerate, sharpening filter and removing subtitle ones? How do I incorporate these three?
Slightly unrelated, but does having -max_muxing_queue_size 400 negatively affect file size or video quality? I've only included this because I'd ran into encoding errors in the past.
Thank you.
My Handbrake log with the above options, if it helps:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.10.100
Duration: 00:02:20.52, start: 0.000000, bitrate: 1487 kb/s
Stream #0:0(und): Video: h264 (High) [avc1 / 0x31637661]
yuv420p, tv, bt709/bt709/bt709
1280x720 [PAR 1:1 DAR 16:9], 1288 kb/s, PAR 1:1 DAR 16:9
29.97 fps, 30k tbn (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) [mp4a / 0x6134706D]
44100 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
handler_name : SoundHandler
[04:26:49] scan: decoding previews for title 1
[04:26:49] scan: audio 0x1: aac, rate=44100Hz, bitrate=192025 English (AAC) (2.0 ch)
[04:26:50] scan: 10 previews, 1280x720, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[04:26:50] scan: supported video decoders: avcodec qsv
[04:26:50] libhb: scan thread found 1 valid title(s)
[04:26:50] starting job
[04:26:50] decomb filter thread started for segment 0
[04:26:50] decomb filter thread started for segment 1
[04:26:50] decomb filter thread started for segment 3
[04:26:50] decomb check thread started for segment 0
[04:26:50] decomb check thread started for segment 1
[04:26:50] yadif thread started for segment 0
[04:26:50] decomb check thread started for segment 3
[04:26:50] mask filter thread started for segment 0
[04:26:50] work: track 1, dithering not supported by codec
[04:26:50] mask filter thread started for segment 1
[04:26:50] work: only 1 chapter, disabling chapter markers
[04:26:50] job configuration:
[04:26:50] * source
[04:26:50] + E:\input.mp4
[04:26:50] + title 1, chapter(s) 1 to 1
[04:26:50] + container: mov,mp4,m4a,3gp,3g2,mj2
[04:26:50] mask filter thread started for segment 3
[04:26:50] + data rate: 1487 kbps
[04:26:50] * destination
[04:26:50] + C:\Users\Hp\Desktop\output.mp4
[04:26:50] + container: MPEG-4 (libavformat)
[04:26:50] + optimized for HTTP streaming (fast start)
[04:26:50] + align initial A/V stream timestamps
[04:26:50] * video track
[04:26:50] + decoder: h264
[04:26:50] + bitrate 1288 kbps
[04:26:50] + filters
[04:26:50] mask filter thread started for segment 2
[04:26:50] + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[04:26:50] + Decomb (mode=39)
[04:26:50] + Framerate Shaper (mode=2:rate=27000000/900000)
[04:26:50] + frame rate: 29.970 fps -> peak rate limited to 30.000 fps
[04:26:50] mask erode thread started for segment 1
[04:26:50] + Crop and Scale (width=1280:height=720:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[04:26:50] + source: 1280 * 720, crop (0/0/0/0): 1280 * 720, scale: 1280 * 720
[04:26:50] + Sharpen (lapsharp) (y-strength=0.2:y-kernel=isolap:cb-strength=0.2:cb-kernel=isolap)
[04:26:50] + Output geometry
[04:26:50] + storage dimensions: 1280 x 720
[04:26:50] + pixel aspect ratio: 1 : 1
[04:26:50] + display dimensions: 1280 x 720
[04:26:50] + encoder: H.265 (libx265)
[04:26:50] + preset: medium
[04:26:50] + profile: auto
[04:26:50] + quality: 28.00 (RF)
[04:26:50] * audio track 1
[04:26:50] mask erode thread started for segment 2
[04:26:50] + decoder: English (AAC) (2.0 ch) (track 1, id 0x1)
[04:26:50] + bitrate: 192 kbps, samplerate: 44100 Hz
[04:26:50] + mixdown: Stereo
[04:26:50] + encoder: AAC (libavcodec)
[04:26:50] + bitrate: 128 kbps, samplerate: 48000 Hz
[04:26:50] mask erode thread started for segment 3
[04:26:50] mask dilate thread started for segment 0
[04:26:50] mask dilate thread started for segment 1
[04:26:50] mask dilate thread started for segment 2
[04:26:50] decomb check thread started for segment 2
[04:26:50] yadif thread started for segment 1
[04:26:50] yadif thread started for segment 2
[04:26:50] yadif thread started for segment 3
[04:26:50] MTFrame thread started for segment 1
[04:26:50] MTFrame thread started for segment 2
[04:26:50] MTFrame thread started for segment 3
[04:26:50] mask dilate thread started for segment 3
[04:26:50] sync: expecting 4211 video frames
[04:26:50] mask erode thread started for segment 0
[04:26:50] decomb filter thread started for segment 2
[04:26:50] MTFrame thread started for segment 0
x265 [info]: HEVC encoder version 2.6
x265 [info]: build info [Windows][GCC 7.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 2 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 30 / 300 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=4 deblock sao
[04:26:50] sync: first pts video is 0
[04:26:50] sync: "Chapter 1" (1) at frame 1 time 0
[04:26:50] sync: first pts audio 0x1 is 0
[04:40:02] reader: done. 1 scr changes
[04:40:13] work: average encoding speed for job is 5.245789 fps
[04:40:13] comb detect: heavy 3 | light 10 | uncombed 4198 | total 4211
[04:40:13] decomb: deinterlaced 3 | blended 10 | unfiltered 4198 | total 4211
[04:40:13] vfr: 4211 frames output, 0 dropped and 0 duped for CFR/PFR
[04:40:13] vfr: lost time: 0 (0 frames)
[04:40:13] vfr: gained time: 0 (0 frames) (0 not accounted for)
[04:40:13] aac-decoder done: 6052 frames, 0 decoder errors
[04:40:13] h264-decoder done: 4211 frames, 0 decoder errors
[04:40:13] sync: got 4211 frames, 4211 expected
[04:40:13] sync: framerate min 18.394 fps, max 29.970 fps, avg 29.966 fps
x265 [info]: frame I: 18, Avg QP:24.13 kb/s: 2900.85
x265 [info]: frame P: 1079, Avg QP:26.64 kb/s: 1040.14
x265 [info]: frame B: 3114, Avg QP:33.15 kb/s: 235.18
x265 [info]: Weighted P-Frames: Y:0.4% UV:0.4%
x265 [info]: consecutive B-frames: 4.0% 1.4% 20.1% 55.7% 18.8%
encoded 4211 frames in 802.93s (5.24 fps), 452.83 kb/s, Avg QP:31.44
[04:40:13] mux: track 0, 4211 frames, 7970061 bytes, 453.68 kbps, fifo 8192
[04:40:13] mux: track 1, 6588 frames, 2254132 bytes, 128.31 kbps, fifo 8192
[04:40:13] libhb: work result = 0
# Encode Completed ...
The Initial Condition of the problem is like this:
1200 : 480 and 800 : 320
I need an equation(or equations) for changing the value but 320 is fixed.
for example: if change 1200->500 and 800->500 then the equation should be 500:320 and 800:320
example 2 :
1200 : 384 and 1000 : 320
example 3 :
1000 : 400 and 800 : 320
example 4 :
2000 : 640 and 1000 :320
Is this what you are looking for?
numerator = 2.5 * denominator