[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Making webms with sound
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /wsr/ - Worksafe Requests

Thread replies: 37
Thread images: 12
File: 1414010123582.webm (191 KB, 500x620) Image search: [Google]
1414010123582.webm
191 KB, 500x620
So how do you make webms with sound?

What formula do you use?

My current one for basic webms is

ffmpeg -i "file location" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -crf 4 -b:v 3072*1024*8/duration*0.975 -vf scale=640:-1 -an outputname.webm
>>
I use one of the Retards but it seems you're missing

-c:a libvorbis -b:a 48k

and set your own bitrate
>>
File: 14427823014.webm (3 MB, 800x544) Image search: [Google]
14427823014.webm
3 MB, 800x544
>>
>>133006
Not OP, but this is great. I thought I was being a clever bastard by using After Effects. Now I realize how wrong I am.
>>
this is the most basic template i use
ffmpeg -i "input.mkv" -c:v libvpx -threads 4 -crf 10 -qmax 55 -b:v 800K -filter_complex "scale=-1:480:flags=lanczos" -c:a libvorbis -ac 2 -qscale:a 1 -ar 22050 -y "output.webm"

-threads is pretty much mandatory, since by default libvpx only uses 1 CPU core. -qmax 55 is a quality floor to prevent the first few seconds of the webm looking awful (note: lower = better quality, but also bigger file size overriding b:v). -filter_complex instead of -vf because i often add other video filters and audio filters. -c:a vorbis audio codec, -ac number of channels (1 = mono takes up less space), -qscale:a are the default quality settings of libvorbis (3 is default, lower is smaller - since the codec is really good 1 or 0 are usually enough, translations:
-ac 1 -qscale:a 0 --> 48 kbps
-ac 1 -qscale:a 2 --> 70 kbps
-ac 2 -qscale:a 0 --> 64 kbps
-ac 2 -qscale:a 1 --> 80 kbps)
-ar is resampling (default 44100 Hz = 44.1 kHz - i usually remove it, but for extremely long videos lowering it to 22.05 kHz makes it sound worse but cuts audio bitrate in half), -y is auto-confirm so ffmpeg doesn't ask every time about pre-existing files when i just want to fine-tune an encode

-r for fps control when i want to encoder longer stuff and -ss/-to to cut sequences i just manually add when the need arises.
>>
File: 1453321005801.webm (3 MB, 960x550) Image search: [Google]
1453321005801.webm
3 MB, 960x550
>>132968
>>
>>132968
>>133041
Firstly, you don't need to specify the audio and video codecs; for a webm extension, it will use VP8 and Vorbis automatically.

Secondly, setting the crf too low just causes bloat. For h.264, you should usually stay in the high teens or low twenties, though I'm not sure off the top of my head if 10 is a good range for VP8. You want it as high as you can go without noticeable quality loss.

Aside from that, that's a good template, though you probably don't need the audio channels most of the time.
>>
Oh, and if you want to burn in subs, add subtitles='SUBS_FILE' to the video filter. If your input file is an mkv, use that for SUBS_FILE.
>>
File: niggers.webm (1 MB, 640x480) Image search: [Google]
niggers.webm
1 MB, 640x480
>>133115
>>133113
>>133041
>>133001
Lets pretend I'm a total retard that knows nothing about webms really and I don't know what any of this means and I one day go lucky and found a formula someone posted on day when webms became a thing two years ago.


I just want a formula that I put the file location in
plug in the time it starts to time it ends
put duration in
and output name

Then take that formula, copy, open command prompt, then paste and hit enter

As for size I like where its at, pic related

I don't know what you guys mean by "set my own bitrate"

>-threads is pretty much mandatory, since by default libvpx only uses 1 CPU core. -qmax 55 is a quality floor to prevent the first few seconds of the webm looking awful (note: lower = better quality, but also bigger file size overriding b:v). -filter_complex instead of -vf because i often add other video filters and audio filters. -c:a vorbis audio codec, -ac number of channels (1 = mono takes up less space), -qscale:a are the default quality settings of libvorbis (3 is default, lower is smaller - since the codec is really good 1 or 0 are usually enough, translations:
>-ac 1 -qscale:a 0 --> 48 kbps
>-ac 1 -qscale:a 2 --> 70 kbps
>-ac 2 -qscale:a 0 --> 64 kbps
>ac 2 -qscale:a 1 --> 80 kbps)
>-ar is resampling (default 44100 Hz = 44.1 kHz
>- i usually remove it, but for extremely long videos lowering it to 22.05 kHz makes it sound worse but cuts audio bitrate in half), -y is auto-confirm so ffmpeg doesn't ask every time about pre-existing files when i just want to fine-tune an encode
>-r for fps control when i want to encoder longer stuff and -ss/-to to cut sequences i just manually add when the need arises.

I don't understand any of the above

Yes, I would like to burn in subs.
Where in the formula do I add that? Do I have to pull subs from somewhere? How?
>>
File: It used to be cool.webm (3 MB, 640x360) Image search: [Google]
It used to be cool.webm
3 MB, 640x360
>>133429
Again my current formula is
ffmpeg -i "file location" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -crf 4 -b:v 3072*1024*8/duration in seconds*0.975 -vf scale=640:-1 -an outputname.webm

Pic related was one of my firsts
The subs are on there because horriblesubs burns theirs in
>>
>>133001
I tried yours
Made it
ffmpeg -i "File locatiob" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -c:a libvorbis -b:a 48k -crf 4 -b:v 3072*1024*duration in seconds/5*0.975 -vf scale=640:-1 -an niggers.webm

I see no difference and still no sound
>>
>>133041
I added "-ar" to it making it
ffmpeg -i "File locatiob" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -c:a libvorbis -b:a 48k -crf 4 -b:v 3072*1024*8/5*0.975 -vf scale=640:-1 -ar 22050 -an niggers.webm

No difference.
And still no sound
>>
WIthout making another thread about webms, could someone make one with sound of

https://www.youtube.com/watch?v=ZOVxMH23TlQ

from 37:46 to 37:51? Can be cropped to make it smaller if that's easier, basically just need gavin in frame and that's it. Tks!
>>
>>133113
crf works completely different than with libx264. there's no default of 23 and every 6 steps lower doesn't double the bitrate. run some tests. the effect on file size is miniscule and the quality impact is not big but noticable.

i am aware i don't need to specify the codecs. i've always done it anyway, since i consider it good coding practice on containers that take multiple codecs. also, when i said the same thing about default values a few days ago i was corrected by another anon - apparently the latest releases of ffmpeg have moved to VP9 and Opus as default codecs (makes total sense to me, haven't tested it though - this kind of stuff is exactly why i like to specify my codecs).

-ac 2 is really handy though. i don't want to check whether the source has 5.1 or not every god damn time.

>>133429
well, it's time to learn, i guess. if you really want a stupidly easy solution, ffmpeg is probably not the right tool for you. in simple english: the bitrate of a file determines its size and the quality of its contents (more bits per second of video = better quality, but bigger file size). your "formula" caluclates the bitrate where you insert seconds. but now you'd have to start splitting the bitrate between video and audio. but on the flipside you can now go up to 4 MB (4092 instead of 3072 in your "formula") since the only boards that allow sound also allow 4 MB webms.

ffmpeg is incredibly powerful, but not easy to handle without some effort and learning the basics. google for "webm academy". it's a huge step-by-step tutorial for beginners i wrote some time ago on /wsg/ - should still be up on some archives. the only things outdated are 2pass (which i didn't understand back then) and possibly the fixing of fonts.conf (seen it work without fixing).
>>
>>133444
>>133451

that's because -an is still in. this kills all audio (and is necessary for all boards except /gif/ and /wsg/).

seriously. if you want to proceed with ffmpeg you need to learn some basics, i'm afraid.
>>
>>133041
>>133451
Okay, yours as is works now
ffmpeg -i "File location" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -threads 4 -crf 10 -qmax 55 -b:v 800K -filter_complex "scale=-1:480:flags=lanczos" -c:a libvorbis -ac 2 -qscale:a 1 -ar 22050 -y fuck.webm

https://a.pomf.cat/iqmrmi.webm

How ever you mentioned some stuff wrong with it
From the above formula, what should be taken out?
And how do I have subs show?
>>
>>133455
Good to know.

I was in the middle of writing a post to help OP out, but ran into a problem myself: I can't seem to get filter_complex to work with both scale and subtitles. I'm using this:
>-filter_complex "scale=-1:480:flags=lanczos;subtitles='thing.mkv'"
And get the error:
>Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_subtitles_1

Isn't that the right syntax for constructing a complex filtergraph? Each part works on its own when I do them as simple filters.

Anyway, OP, I can try to help you out a bit better once I figure this shit out.
>>
File: fgbfhd.png (364 KB, 855x467) Image search: [Google]
fgbfhd.png
364 KB, 855x467
>>133458
Okay, now I've got it more or less
While keeping my formula
Its now
ffmpeg -i "File locatiob" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -c:a libvorbis -crf 4 -b:v 3072*1024*8/Duration in seconds*0.975 -vf scale=640:-1 -ar 22050 -y Outputname.webm

So in the end I needed to add
-c:a libvorbis
-ar "Hz size"
and as
you
>>133457
said
-an kills sound, so take it out

Thank you all for all your help

Now all I have to ask now is how do I put/keep subs in?
>>
>>133461
>>133463
Ah, okay, I figured it out. Comma, not semicolon.

OP, to burn in subs, you need to use the -filter_complex option rather than the -vf option.
>-filter_complex "scale=-1:480:flags=lanczos,subtitles='IN_FILE'"

The 'scale' filter takes a width and height argument, and if one of them is -1, it will calculate that value to maintain the aspect ratio. In the above example, it's making the video 480p. You can change the size as you see fit.

The 'subtitles' filter takes one argument, which is the location of the subs file. If the subs are in the source mkv, then just use the same thing you used for the input file.

You don't need to use -ar unless you need to save space. As the other anon pointed out, using -ac 2 is handy.

That should get you going for now, but take some time to look at the docs and learn how all this actually works.
>>
>>133479
How do I find the location of the subs file?

What the difference between -ac and -ar?
What the 2 for?
>>
>>133491
Well again, if they're embedded subs in the mkv, just use the mkv.
>ffmpeg -i "some.mkv" -filter_complex "scale=-1:480,subtitles='some.mkv'" out.webm

If they're DVDsubs or some other weird format, there's a whole other bunch of shit to go through, but you can cross that bridge when you get to it.

The -ac and -ar options are changing totally different things. The -ar option is the audio sampling rate, and if you don't know what that is, just know that it should be kept at 44.1k, or MAYBE 22.05k at lowest.

The -ac option is setting the number of audio channels. An argument of 1 would flatten it down to mono, and 2 makes it stereo. Using -ac 2 means you don't have to worry about surround-sound audio messing stuff up. Using 1 saves space, if you really need it and the sound isn't particularly important.
>>
File: 1374782163623.jpg (111 KB, 500x500) Image search: [Google]
1374782163623.jpg
111 KB, 500x500
>>133499
This
https://a.pomf.cat/iqmrmi.webm
was made from an mkv.
It had subtitles, but obviously its not ont he webm.
Would I use
ffmpeg -i "some.mkv" -filter_complex "scale=-1:480,subtitles='some.mkv'" out.webm
for it?

Would this be a correct formula for it?

ffmpeg -i "File location" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -c:a libvorbis -crf 4 -b:v 3072*1024*8/Duration in seconds*0.975 -filter_complex "scale=1:480,subtitles='some.mkv'" out.webm -ar 30000 -y Outputname.webm
>>
File: lfdkfnfd.png (41 KB, 676x314) Image search: [Google]
lfdkfnfd.png
41 KB, 676x314
>>133507
Yeah not working
Formula
ffmpeg -i "File location" -ss 00:01:00.000 -to 00:01:10.000 -c:v libvpx -crf 4 -b:v 3072*1024*8/10*0.975 -filter_complex "scale=-1:480:flags=lanczos,subtitles='IN_FILE'" out.webm -ar 22050 -y Outputname.webm

Results in pic related
>>
>>133452
just one bump
>>
File: kfmn.png (40 KB, 650x314) Image search: [Google]
kfmn.png
40 KB, 650x314
>>133513
and forumula

ffmpeg -i "File location" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -c:a libvorbis -crf 4 -b:v 3072*1024*8/Duration in seconds*0.975 -filter_complex "scale=-1:480,subtitles=file location" -ar 22050 -y Outputname.webm

results in pic related
>>
>>133513
Did you even read the error? You left the placeholder 'IN_FILE' there instead of plugging in the actual input file.

>>133520
That one is because you're using absolute paths instead of relative. Open the command window in the same folder as the file you're using, so you don't have to use file paths with backslashes. Otherwise, you'll have to escape the backslashes with more backslashes.

>>133507
Three things wrong there. First, scale should have a -1, not 1, unless you wanted the video one pixel wide. Second, you have the output twice. Output filename only goes once, at the very end.

Third and most importantly, do not set the sampling rate to some weird number like 30k. Don't do it. Just leave that option out entirely, as a matter of fact.

Aside from those, yes, that should work.
>ffmpeg -i "File location" -ss 00:00:00.000 -to 00:00:00.000 -c:v libvpx -c:a libvorbis -crf 4 -b:v 3072*1024*8/Duration in seconds*0.975 -filter_complex "scale=-1:480,subtitles='File location'" out.webm
>>
Me >>133542 again.

This is the exact command I used as a test just now:
>ffmpeg -i "[HorribleSubs] Anne Happy - 09 [720p].mkv" -ss 5 -to 20 -c:v libvpx -c:a libvorbis -crf 4 -b:v 830k -filter_complex "scale=-1:480,subtitles='[HorribleSubs] Anne Happy - 09 [720p].mkv'" tes.webm

It worked exactly as expected. If you run this (replacing the filename and times with what you want) and it doesn't work, try updating ffmpeg.
>>
File: df;lkng.png (198 KB, 1366x768) Image search: [Google]
df;lkng.png
198 KB, 1366x768
>>133542
What do you mean open the command folder in same window as the file?
To open command prompt, I end up having to go to start, type command, click command prompt then paste and enter
If I just put "[horriblesubs] show.mkv" I get
No such file or directory

Here is the full one formula names and all
ffmpeg -i "C:\Users\Dan\Desktop\Internet Related\Anime\This Season\Kiznavier\[HorribleSubs] Kiznaiver - 08 [720p].mkv" -ss 00:001:00.000 -to 00:01:10.000 -c:v libvpx -c:a libvorbis -crf 4 -b:v 3072*1024*8/10*0.975 -filter_complex "scale=-1:480,subtitles='C:\Users\Dan\Desktop\Internet Related\Anime\This Season\Kiznavier\[HorribleSubs] Kiznaiver - 08 [720p].mkv'" niggers.webm

I also have anne happy 09 too
I copied yours

ffmpeg -i "[HorribleSubs] Anne Happy - 09 [720p].mkv" -ss 5 -to 20 -c:v libvpx -c:a libvorbis -crf 4 -b:v 830k -filter_complex "scale=-1:480,subtitles='[HorribleSubs] Anne Happy - 09 [720p].mkv'" tes.webm

Same "No such file or directory" error
>>
>>133575
I use -b:v 3072*1024*8/duration*0.975
because at one time I used to use
-b:v 000k before, and it looked like shit and kept being a guessing game
>>
>>133575
>What do you mean open the command folder in same window as the file?
You go to the folder where the video is, hold shift, right-click (not on a file), and 'Open command window here'. This allows you to just use the short file name, instead of the full absolute path.

If for some godawful reason you do want to use the full path, you have to escape each backslash with another backslash, sometimes multiple times, which becomes a huge mess.

One other thing I noticed, you may want to include the '-sn' option. It seems ffmpeg is a little too helpful, and will try to embed softsubs in the mkv, which you usually don't want.
>>
File: lrekfnmde.png (44 KB, 652x332) Image search: [Google]
lrekfnmde.png
44 KB, 652x332
>>133584
Okay, that seems to do it, it must have been a location issue, I was even able to keep my -b:v 3072*1024*8/duration*0.975

However, what is with this?

I thought it was just my formula, but it did it for yours too.

If its nothing major

Thank you for all your help
>>
>-an
That means no sound.
RTFM: https://ffmpeg.org/ffmpeg.html
>>
>>133457
Last question
For the ones with sounds I make, I get
Invalid Stream when I try to post them on /gif/ and /wsg/
Whats wrong with them?
>>
>>133592
I noticed that as well. Not sure what it means, but since it didn't seem to have any ill effects, I didn't bother looking into it.

>>133603
If you specified libvorbis, I honestly don't know. 4chan is pretty strict about what you can upload. Maybe someone on /wsg/ would have a better idea of the specifics.
>>
>>133605
Now even if I take out libvorbis it says invalid stream
>>
>>133609
Try -sn, maybe your source has a subtitle track and ffmpeg is converting that too.
>>
>>133612
that did it

See webm
https://a.pomf.cat/fygfbc.webm
Thread replies: 37
Thread images: 12

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.