Open humdingerb opened 1 year ago
There are several codec options still in there that don't work. Just discovered that the vorbis audio codec option doesn't work as well (needs to be "libvorbis"). vp7 (vp8 and 9 as well?) only works as decoder, not as encoder. The long term solution for this is to get the supported codecs and formats from ffmpeg, and populate the menus according to that. I've already got a rough idea how to implement it but that won't be ready for the release. It's not only parsing the info for the codecs, it's also accounting for the dependencies(not all video codecs work with all audio codecs and all container formats, and so on). My suggestion for a quick solution before the release is that we hand pick 4 or 5 of the most popular formats that work with our ffmpeg version, and do some testing to ensure that they work.
@humdinger: can you maybe rename the issue to be more general, something like: audio and video codec options that don't work. Then we can collect the info about not working options here and discuss which ones to remove and add.
All video encoders except vp7 seem to work and only the vorbis audio encoder doesn't. Maybe removing those two is all that's needed.
@humdingerb : I've worked on some code that fetches the valid options for container formats, video, and audio encoders directly from ffmpeg. Works great, the problem is the sheer number of options. If I remember correctly it returns about 60 container formats, 80 video formats and a few less audio formats. Far too many to conveniently access from a normal dropdown menu. Do you have an idea how we could handle this? I'll finish the implementation anyway so that we have a branch to test different solutions.
Yeah. Here's the output of -codecs and -formats: codecs.txt formats.txt
I don't think we can handle that amount of codecs/formats with a GUI. I'd say we include the most common ones and let the niche users adjust the command line manually.
Here is my suggestion which codecs/containers to include. Mind you, that's just from going through those lists and guessing which ones make sense (and at least need to support 'encoding'). It'll need testing if those actually work (possibly also by trying to play them back under Linux and Windows). Also, feel free to include ones I missed or remove any that are actually not popular...
So, I checked all our container/video/audio combinations. Maybe @andimachovec would like to look into that... :) Here are my findings:
General:
[dca @ 0x1140e66ce880] The encoder 'dca' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
-> even adding '-strict -2' needs a bitrate >= 320 kbits
Video+Audio Containers:
[mp4 @ 0x11a122ce94c0] Could not find tag for codec theora | vp8 | wmv1 | wmv2 in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid Argument Error initializing output stream 0:0 --
mpg container:
[mpeg @ 0x1074538874c0] Unsupported audio codec. Must be one of mp1, mp2, mp3, 16-bit pcm_dvd, pcm_s16be, ac3 or dts. Could not write header for output file #0 (incorrect codec parameters ?): Out of memory Error initializing output stream 0:0 -- -->It accepts pcm_s16be, we include pcm_s16le. Should we change that?
ogg container: works only with theora & vorbis | flac
webm container:
[webm @ 0x1259f512c4c0] Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM. Could not write header for output file #0 (incorrect codec parameters ?): Invalid Argument
Audio-only Conainer:
mp3 container accepts only mp3.
oga container accepts flac | mp3 | pcm16 -->vorbis produces audio garbage
wav container accepts aac (result crashes MediaPlayer), ac3, flac, mp3, pcm16 -->vorbis produces audio garbage
Maybe @andimachovec would like to look into that... :)
Sure, here we go ;-)
The encoder 'dca' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it. -> even adding '-strict -2' needs a bitrate >= 320 kbits
The "-strict -2" is no problem we could just add it to the format specifier in the video codecs vector. Not much we can do about the bitrate limitation at the moment. But I think isn´t really a very common codec so we can easily remove it from the menu if it is a problem.
Also: even with "Enable video encoding" disabled, the output file of audio-only containers (mp3, oga, wav) contains video.
Not sure about this. I noticed that Mediaplayer displays a still image when playing these files, but ffprobe only shows an audio stream, no video. Also if I play them on Linux (tested with Celluloid and VLC) there´s no video or image at all, only audio. Could this be a bug in MediaPlayer or MediaKit?
The incompatibility stuff between container formats and certain codecs is expected. Not every container works with every codec. I´m already working on a solution, each container format entry gets it´s list of supported codecs. I thought it would be OK to include this into the next release, but if you think it should go into the upcoming release I think I can get it ready within the week.
The "-strict -2" is no problem we could just add it to the format specifier in the video codecs vector. Not much we can do about the bitrate limitation at the moment. But I think isn´t really a very common codec so we can easily remove it from the menu if it is a problem.
I suppose it needs something similar to your planned audio/video/container capabilities. If the DTS codec is selected, the <320kbits menu items of the bitrate popup need to be disabled and - if a >=320kbits bitrate wasn't already set - set 320kbits. I'd consider DTS a fairly common codec for movies and tv shows.
Also: even with "Enable video encoding" disabled, the output file of audio-only containers (mp3, oga, wav) contains video. Could this be a bug in MediaPlayer or MediaKit?
Ha, now that you say that! I saved all those converted file in the same folder and the same name, just with a different extension. It appears, similarly to how additional subtitle .srt files work, MediaPlayer shows a similarly named video file, when asked to play back the audio-only file. In my case, I had a Test.mp3 with the audio only opened in MediaPlayer, and it automatically played the Test.mp4 audio/video source file as video along side it...
I´m already working on a solution, each container format entry gets it´s list of supported codecs. I thought it would be OK to include this into the next release,[...]
Yeah, that's fine. Let's save some features for the next release. :)
I suppose it needs something similar to your planned audio/video/container capabilities. If the DTS codec is selected, the <320kbits menu items of the bitrate popup need to be disabled and - if a >=320kbits bitrate wasn't already set - set 320kbits.
Yep. We can introduce fields for minimum and maximum bitrate quite easily.
I'd consider DTS a fairly common codec for movies and tv shows.
Let's keep it, and add the needed "-strict -2". So it can at least be used, as long as the user figures out the minimum bitrate.
I saved all those converted file in the same folder and the same name, just with a different extension
Yeah, same here. Can you confirm that your files are audio only? (ffprobe output, playback on different video player / OS)
Yeah, same here. Can you confirm that your files are audio only? (ffprobe output, playback on different video player / OS)
They definitely are audio only. After moving them out of the folder with the similarly named video files, they are played back as audio-only. The much smaller file size is a dead give-away, too... :)
OK, created #97 to add "-strict -2".
From further up:
[mpeg @ 0x1074538874c0] Unsupported audio codec. Must be one of mp1, mp2, mp3, 16-bit pcm_dvd, pcm_s16be, ac3 or dts. Could not write header for output file #0 (incorrect codec parameters ?): Out of memory Error initializing output stream 0:0 --
-->It accepts pcm_s16be, we include pcm_s16le. Should we change that?
@andimachovec: what do you think use pcm_s16be instead?
@andimachovec: what do you think use pcm_s16be instead?
I have no idea to be honest :-) This is about the byte order, little endian vs. big endian. I did a bit of googling briefly to find out which one is more common but didn't find much. If big endian works with more container formats let's use it. Or we could add both. I'll try to find out a bit more on the topic.
If you don't learn anything else, I'd say we go "big endian" as that's needed for the mpeg container.
We should avoid adding too many niche options, as that would confuse the regular user. We cannot even provide a fraction of the available codecs in the GUI, and advanced users can always edit the provided commandline.
No news here. There's quite a few of different PCM formats used in WAV files. I can't tell which one is peferrable over the other.
Choosing "vp7" as video format fails the encoding. Should we remove it from the options?