[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: Godward_Idleness_1900.jpg (1.03 MB, 1179x1998)
1.03 MB JPG
Many music videos on youtube are just a static frame and several hours long. I wrote a simple script to automatically extract the frame, remux without video track and attach the frame as an attachment. In the future I will implement detecting and croppng black bars, and better heuristics for auto-detecting whether a video really is static. eg sampling every minute or so and running SSIM on each frame.

@echo off
set "mkvdir=C:\Program Files\MKvToolNix"
FOR %%M IN (*.mkv) DO (
ffmpeg -y -v 0 -i "%%M" -ss 00:00:00 -frames:v 1 "%TEMP%\%%~nM.png" > NUL
truepng /omax /quiet "%TEMP%\%%~nM.png"
"%mkvdir%\mkvmerge.exe" --no-video --no-track-tags --no-global-tags --attach-file "%TEMP%\%%~nM.png" -o "%%~dpnM.mka" "%%M"
IF EXIST "%%~dpnM.mka" (del "%%M")
)
pause


Yes it's written in batch. I don't know bash or powershell. results in test cases when I've done this manually are a 500+ MB file can be reduced to the size of the audio track, usually like 50 - 70 mb for an hour or two. Uses truepng for the image optimization, you can repalce that with pngout, optipng, zopflipng, whatever.. No tools are used to losslessly optimize the audio, as the results for AAC and opus have been poor in the past.
>>
good job but
>winglows
ngmi
>>
>>109471630
I'm still on the same Windows 7 install I had like 15 years ago. it werks. I use MSYS2 (gcc) and the linux toolchain environment for other stuff though, and prefer it greatly.
>>
>>109471573
>I've done this manually are a 500+ MB file can be reduced to the size of the audio track

Rewrite the script to take a URL as input, and download just the audio track, then and a single frame from the video
>>
>>109471728
Good idea. iirc ffmpeg can use yt-dlp, or pipe from it. This idea originated from a broader local file optimization script.
>>
>>109471752
One potential issue is parsing whole channels. yt-dlp does this automatically. Might have to do it in stages, all audio and chapters first, then 1 frame of video each, then mux.
>>
>>109471690
nah, it doesn't werks
>>
The masculine urge to rape over the balcony in front of her loved ones
>>
>>109472621
She's busy playing with her pussy.
>>
>>109471573
what's the point? why not just download the audio track?
>>
>>109472797
They're files I already have on the drive. The original intention was to have a script that you can throw any video into and it'll figure out if it can do that without any loss. Otherwise it would be better to automate by grabbing chapters and the audio track and muxing it with a single frame.

My solution was based on the problem as it existed I suppose.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.