BtbN changed the topic of #ffmpeg to: Welcome to the FFmpeg USER support channel | Development channel: #ffmpeg-devel | Bug reports: https://ffmpeg.org/bugreports.html | Wiki: https://trac.ffmpeg.org/ | This channel is publically logged | FFmpeg 7.0 is released
Buliarous has joined #ffmpeg
Kei_N has joined #ffmpeg
chiselfuse has quit [Ping timeout: 260 seconds]
chiselfuse has joined #ffmpeg
buhman has quit [Ping timeout: 252 seconds]
sopparus has quit [Ping timeout: 248 seconds]
llinguini has quit [Ping timeout: 248 seconds]
Naleksuh has quit [Ping timeout: 252 seconds]
Son_Goku has quit [Ping timeout: 252 seconds]
jdek has quit [Ping timeout: 252 seconds]
yans has joined #ffmpeg
fristed has joined #ffmpeg
buhman has joined #ffmpeg
sopparus has joined #ffmpeg
Son_Goku has joined #ffmpeg
jdek has joined #ffmpeg
Naleksuh has joined #ffmpeg
llinguini has joined #ffmpeg
vincejv has quit [Remote host closed the connection]
FlorianBad has quit [Remote host closed the connection]
AlwynEvokedHippe has joined #ffmpeg
xx has quit [Ping timeout: 260 seconds]
<AlwynEvokedHippe>
Hi folks, hope you're all well.
<AlwynEvokedHippe>
I have a question regarding output formats.
<AlwynEvokedHippe>
Given a certain "codec_name" for a stream (as provided by ffprobe), can I map that to a value for the "-f" flag in ffmpeg?
<AlwynEvokedHippe>
---
<AlwynEvokedHippe>
The context being I have an old video file which ffprobe tells me has a "msmpeg4v3" codec_name, and codec_tag_string "DIV3", but toying with ffmpeg "-f" values like msmpeg4v3, msmpeg, h263, DIV3 all result in either an error telling me that muxer doesn't exist, or that it's not compatible for the input video stream.
<AlwynEvokedHippe>
I've tried looking at the ffmpeg man page for the "-f" flag, and doing a (admittedly cursory) search on the Git for keywords, but I'm a bit stumped... :)
<AlwynEvokedHippe>
I'd be very appeciative if anyone had advice.
<another|>
`-f` sets the file format, not the codec
<aaabbb>
what is it you are trying to do?
<AlwynEvokedHippe>
Apologies for the multiple messages, didn't realise LimeChat would do that at line-downs.
<AlwynEvokedHippe>
Ah that seems clear now. I was a bit confused as an example I saw online where "-f" had a value of h264, which I associate with the codec, but I guess that can be a container too in some instances.
<another|>
that's raw h264
<another|>
some codecs can be contained in a raw file without a container
<aaabbb>
there are very few situations where you'd use raw h264. for -f you could do mp4, or matroska etc but the codec is still h264 (assuming that's what it is)
<AlwynEvokedHippe>
aaabbb, it is probably a X-Y problem I have to admit. One part of an (embarrisingly hacky, just for home use), 264 to 265 conversion script I wrote had me read a single video stream size by piping out to stdout and reading bytes counted. This worked by making use of "-f h264".
<AlwynEvokedHippe>
*embarrassingly
<aaabbb>
is it a raw h264 stream you have and you want to convert it to h265?
<aaabbb>
or is it in a container?
<aaabbb>
the minimum you can do: ffmpeg -i $in -c:v libx265 out.mp4
<aaabbb>
if ffmpeg recognizes the input, then it will transcode it to h265. assuming no audio (otherwise it will default to transcoding audio to aac)
<AlwynEvokedHippe>
That part I have working, although it's probably all sorts of bad-practice on my part. I read H265 requires about half the bit rate, and to provide the 265 converter with a constant bit rate, you need to do 2-pass encoding, so part of my script ended up like this.
<AlwynEvokedHippe>
# ... a few commands utilizing bc to get a kbit/s value into a variable, then divide by that by 2, and go through a 2-pass H265 conversion with calculated bit rate
<AlwynEvokedHippe>
It was mostly just out of curiosity that led me to throw this old "msmpeg4v3" file into it, and got me to wondering about the "-f" option.
<BtbN>
Never heard "half the bitrate". It's far from that simple
minimal has quit [Quit: Leaving]
<BtbN>
also, such comparisons always assume you are encoding the same lossless input
<aaabbb>
AlwynEvokedHippe: be aware that transcoding *always* causes quality loss with lossy codec like this
<BtbN>
re-encoding something already lossy throws a lot of it out of the window, and often isn't worth it, unless the original uses an excessive bitrate
<aaabbb>
that's what i find too. if the original uses excessive bitrate like it is from a phone recording in real-time at 20mbps then it makes sense to transcode
<aaabbb>
it's not like decompressing an old zip and recompressing with a newer xz. with lossy codecs for video or audio, you're stuck with whatever it was originally encoded as, unless you are willing to lose quality to transcode
Rue has quit [Quit: WeeChat 4.3.3]
Rue has joined #ffmpeg
<AlwynEvokedHippe>
That does seem to be the case from what I've read online :)
<AlwynEvokedHippe>
If it's the case quality loss will occur, unless there's an excessive bitrate, then maybe updating my old videos to H265 isn't worth it.
<AlwynEvokedHippe>
In any case, thanks guys, the "-f" problem I had was answered up above when it was clarified that it's for file/container format specifically rather than codec, thanks! I RTFM, but I need to read it better, haha
<BtbN>
there is _always_ quality loss
<BtbN>
it's just that if the bitrate is so high that the content is virtually lossless, taking the quality hit is worth the huge savings in size
Suchiman has quit [Quit: Connection closed for inactivity]
<aaabbb>
AlwynEvokedHippe: it's rarely useful to "update" videos if they are already in a distribution format (vs an intermediate format used for editing, like prores)
<aaabbb>
because there will always be a newer and better codec. av1 is better than h265 for example but i wouldn't even transcode old videos to it unless i was keeping the originals
<aaabbb>
transcoding is fine to cut the size at the expense of quality, as long as you keep the original. so it's what i do if i'm going to send someone a video that's too big otherwise
<AlwynEvokedHippe>
Gotcha, cheers. Suppose it's a use-case-by-use-case scenario really.
<AlwynEvokedHippe>
As a side note and pure technical curiosity at this point since I won't go down this path, instead of my hacky "ffmpeg ... -f h264 - | wc --bytes" method of finding the size of a single stream, is there a more sane way to do this?
<BtbN>
multiply its bitrate by the length
<BtbN>
ffprobe shows both
<BtbN>
the bitrate is only an estimate though, and can be way off
<AlwynEvokedHippe>
Ah fair fair. I can see "bit_rate" under the "format" section, so I guess that's just a cumulative sort of number for all v/a/s streams.
<AlwynEvokedHippe>
Ah I'm a dummy, there is one in the stream itself, too. Sorry
<AlwynEvokedHippe>
Anyway, I think I've wasted enough of you kind folks' time with my silly questions :) Thanks again for the help!
Vonter has joined #ffmpeg
AlwynEvokedHippe has quit [Quit: Leaving...]
yans has quit [Ping timeout: 244 seconds]
vincejv has joined #ffmpeg
lucasta has joined #ffmpeg
Tinos has joined #ffmpeg
Tinos has quit [Remote host closed the connection]
Tinos has joined #ffmpeg
Tinos has quit [Ping timeout: 256 seconds]
Tinos has joined #ffmpeg
evilscreww has joined #ffmpeg
FlorianBad has joined #ffmpeg
evilscreww has quit [Ping timeout: 240 seconds]
Tinos has quit [Ping timeout: 256 seconds]
Kei_N has quit [Read error: Connection reset by peer]
namazso has quit [Remote host closed the connection]
namazso has joined #ffmpeg
Tinos has joined #ffmpeg
Ekho has quit [Quit: CORE ERROR, SYSTEM HALTED.]
Ekho has joined #ffmpeg
SystemError has quit [Remote host closed the connection]
five6184803391 has quit [Remote host closed the connection]
SystemError has joined #ffmpeg
five6184803391 has joined #ffmpeg
YuGiOhJCJ has joined #ffmpeg
lucasta has quit [Quit: Leaving]
mikehu44 has joined #ffmpeg
nact has quit [Ping timeout: 244 seconds]
Renb has joined #ffmpeg
Rena has quit [Ping timeout: 252 seconds]
rv1sr has joined #ffmpeg
lavaball has joined #ffmpeg
Tinos has quit [Ping timeout: 256 seconds]
jagannatharjun has joined #ffmpeg
vincejv has quit [Ping timeout: 252 seconds]
vincejv has joined #ffmpeg
HerbY_NL has joined #ffmpeg
<johnjaye>
is transcoding really that big of a problem?
<aaabbb>
johnjaye: problem meaning quality loss?
<johnjaye>
yes. is it quantifiable
<johnjaye>
like 1% loss per capita?
<aaabbb>
oh much much much more
<aaabbb>
and how much depends on many factors
<johnjaye>
oh i see. so if i sit here and reencode something from say x264 to 265 repeatedly it will degrade rapidly?
<JEEB>
yes, esp. if you expect it to generally lead to smaller files
<aaabbb>
or from x264 to x264, or from $anything to $anything
<JEEB>
since of course you can keep similar quality by giving enough bits, but that can be as much if not more since you are not re-encoding compression artifacts from the initial encode :D
<JEEB>
uhh... "you are now"
<aaabbb>
the only exception is lossless codecs, but they have bitrates that are too big for typical vidos that you just want to watch
<johnjaye>
it sounds like you will increase file size while decreasing quality if you do an infinite sequence of reencodes
<aaabbb>
the file size is arbitrary, you can make it get bgger, or smaller, or stay the same
<aaabbb>
whether the default settings result in a bigger or smaller file than the input doesn't matter
<aaabbb>
the only time to reencode is if you either start with a mezzanine codec like prores (ultra high quality, bad compression ratio) and want to convert it into a form ready for distribution, or if you are temporarily converting a big file to something smaller eg to show someone, and you don't mind quality loss
<aaabbb>
same thing is true with audio codecs btw
<aaabbb>
lossy ones
vincejv has quit [Ping timeout: 255 seconds]
vincejv has joined #ffmpeg
lavaball has quit [Remote host closed the connection]
xx has joined #ffmpeg
Tinos has joined #ffmpeg
Tinos has quit [Remote host closed the connection]
Tinos has joined #ffmpeg
evilscreww has joined #ffmpeg
kasper93_ has joined #ffmpeg
kasper93 has quit [Ping timeout: 272 seconds]
evilscreww has quit [Quit: Leaving]
Suchiman has joined #ffmpeg
Blacker47 has joined #ffmpeg
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
Tinos has quit [Remote host closed the connection]
Tinos has joined #ffmpeg
mikwee has joined #ffmpeg
<mikwee>
Hello
<mikwee>
The command `ffplay -f video4linux2 -list_formats all /dev/video1` results in the error `[video4linux2,v4l2 @ 0x7f79a8000c80] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
<mikwee>
/dev/video1: Inappropriate ioctl for device`
<mikwee>
I'm trying to play output from a capture card