Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-110790

Allow QMediaRecorder to accept a source QIODevice

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.4.1
    • Multimedia

    Description

      QAudioRecorder allows selection of the source via setAudioInput, but it would be nice if it could also take a QIODevice as the source.

      Possible implementation is an overload of record() that takes a QIODevice parameter. There are other options.

      Justification:

      Afaict QAudioRecorder is the only API Qt provides for writing audio to container files (e.g. WAV).

      Also, QAudioRecorder can't accept custom audio data, meaning that while it is useful for directly recording a source, it is also only useful for directly recording a source. It can't be used, for example, to record generated audio data, or to record audio data that has been obtained via a QAudioInput and then modified (e.g. a filter applied or something) or intercepted (to e.g. render a live waveform or something).

      Therefore, despite clearly having the code for writing audio containers (i.e. QAudioRecorder exists), Qt does not seem to provide any way to record generated or modified audio data to a container format. 

      The only capability Qt has for writing audio to container files, then, is when audio is directly recorded from the source. Any other use case is not possible. This is pretty limited, and represents only the most fundamentally basic use case. Anything beyond that and Qt Multimedia is no longer useful.

      This seems to be an unfortunate gap in the Qt Multimedia API. Currently, if I want to, say, generate audio data, or e.g. apply a low pass filter to incoming audio and write it to a WAV file, I can't use QAudioRecorder. I have to write the container manually. Also because it's rather cumbersome to use a 3rd-party library or reimplement any type of compression, realistically I'm limited to PCM WAV files, as it would be highly inconvenient to bring in, say, an AAC or MP3 encoder, especially when QAudioRecorder theoretically supports a number of different codecs and containers which aren't accessible in these use cases.

      Allowing QAudioRecorder to take a QIODevice opens up an infinite number of new possibilities for writing audio to files.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtmultimediateam Qt Multimedia Team
            jasonc Jason Cipriani
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes