Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-working audio/video formats #84

Open
humdingerb opened this issue Jan 24, 2023 · 14 comments
Open

Non-working audio/video formats #84

humdingerb opened this issue Jan 24, 2023 · 14 comments
Milestone

Comments

@humdingerb
Copy link
Member

Choosing "vp7" as video format fails the encoding. Should we remove it from the options?

@andimachovec
Copy link
Contributor

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.

@humdingerb humdingerb changed the title Video format "vp7", unknown encoder Non-working audio/video formats Jan 25, 2023
@humdingerb
Copy link
Member Author

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.

@andimachovec
Copy link
Contributor

@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.

@humdingerb
Copy link
Member Author

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...

  • Video codecs
    • "mjpeg" | Motion JPEG
    • "mpeg1video" | MPEG-1 video
    • "mpeg2video" | MPEG-2 video (decoders: mpeg2video mpegvideo)
    • "mpeg4" | MPEG-4 part 2
    • "theora" | Theora (encoders: libtheora)
    • "vp8" | On2 VP8 (decoders: vp8 libvpx) (encoders: libvpx)
    • "vp9" | Google VP9 (decoders: vp9 libvpx-vp9) (encoders: libvpx-vp9)
    • "wmv1" | Windows Media Video 7
    • "wmv2" | Windows Media Video 8
    • [doesn't support encoding: "h264" | H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]
  • Audio codecs
    • "aac" | AAC (Advanced Audio Coding) (decoders: aac aac_fixed libfdk_aac) (encoders: aac libfdk_aac)
    • "ac3" | ATSC A/52A (AC-3) (decoders: ac3 ac3_fixed) (encoders: ac3 ac3_fixed)
    • "dts" | DCA (DTS Coherent Acoustics) (decoders: dca) (encoders: dca)
    • "flac" | FLAC (Free Lossless Audio Codec)
    • "mp2" | MP2 (MPEG audio layer 2) (decoders: mp2 mp2float) (encoders: mp2 mp2fixed)
    • "mp3" | MP3 (MPEG audio layer 3) (decoders: mp3float mp3) (encoders: libmp3lame)
    • "pcm_s16le" | PCM signed 16-bit little-endian
    • "vorbis" | Vorbis (decoders: vorbis libvorbis) (encoders: vorbis libvorbis)
  • Audio/Video container formats
    • "avi" - AVI (Audio Video Interleaved)
    • "matroska" | Matroska
    • "mp4" | MP4 (MPEG-4 Part 14)
    • "mpeg" | MPEG-1 Systems / MPEG program stream
    • "ogg" | Ogg
    • "webm" | WebM
  • Audio container formats
    • "flac" | raw FLAC
    • "mp3" | MP3 (MPEG audio layer 3)
    • "oga" | Ogg Audio
    • "wav" | WAV / WAVE (Waveform Audio)

@humdingerb
Copy link
Member Author

So, I checked all our container/video/audio combinations. Maybe @andimachovec would like to look into that... :)
Here are my findings:

General:

  • Anything with DTS codec:

[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

  • Also: even with "Enable video encoding" disabled, the output file of audio-only containers (mp3, oga, wav) contains video.

Video+Audio Containers:

  • mp4 container doesn't work with: theora | vp8 | wmv1 | wmv2:

[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

@andimachovec
Copy link
Contributor

andimachovec commented Feb 13, 2023

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.

@humdingerb
Copy link
Member Author

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. :)

@andimachovec
Copy link
Contributor

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)

@humdingerb
Copy link
Member Author

humdingerb commented Feb 17, 2023

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... :)

@humdingerb
Copy link
Member Author

OK, created #97 to add "-strict -2".

@humdingerb
Copy link
Member Author

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
Copy link
Contributor

@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.

@humdingerb
Copy link
Member Author

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.

@scottmc scottmc added this to the Ver 1.2 milestone Feb 21, 2023
@andimachovec
Copy link
Contributor

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.

humdingerb pushed a commit that referenced this issue Apr 11, 2023
There are several 16bit PCM options available. "Big endian" is
expected by the MPG container, so it makes sense to use that
version of PCM audio.

See #84
@scottmc scottmc modified the milestones: Ver 1.2, Ver 1.3 Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants