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

Linux does not support mp4 or m4a? #41

Closed
lqniunjunlper opened this issue Apr 14, 2020 · 8 comments
Closed

Linux does not support mp4 or m4a? #41

lqniunjunlper opened this issue Apr 14, 2020 · 8 comments

Comments

@lqniunjunlper
Copy link

Only wav?

@lqniunjunlper
Copy link
Author

Makefile:

if ( APPLE OR WIN32 ) option( NIMEDIA_ENABLE_MP3_DECODING "Enable ni-media mp3 decoding" ON ) option( NIMEDIA_ENABLE_MP4_DECODING "Enable ni-media mp4 decoding" ON ) else() option( NIMEDIA_ENABLE_MP3_DECODING "Enable ni-media mp3 decoding" OFF ) option( NIMEDIA_ENABLE_MP4_DECODING "Enable ni-media mp4 decoding" OFF ) endif()

In os_source.h, there is no os_source definition for Linux?

`#pragma once

#include <ni/media/audio/source_impl.h>

#include <boost/predef.h>

#if BOOST_OS_MACOS || BOOST_OS_IOS
#include <ni/media/audio/os/mac/core_audio_source.h>
template
using os_source = source_impl<core_audio_source>;
#elif BOOST_OS_WINDOWS
#include <ni/media/audio/os/win/media_foundation_source.h>
template
using os_source = source_impl<media_foundation_source>;
#endif`

``

@lqniunjunlper
Copy link
Author

On Linux, i got an error of Segmentation fault.

ifstream.cpp:65] ifstream:ttt.wav
Segmentation fault

std::string file="test.wav";
auto stream = audio::ifstream(file);

`ifstream::ifstream( const std::string& file )
: ifstream()
{
#if NIMEDIA_ENABLE_ITUNES_DECODING
if ( is_itunes_url( file ) )
{
auto source = avassetreader_source( file, 0 );
auto info = source.info();
*this = ifstream( make_stream_buffer( std::move( source ) ), std::make_unique<info_type>( std::move( info ) ) );
return;
}
#endif

LOG(INFO) << __func__ << ":" << file;

auto container = ifstream_container( file );
if ( !container )
    throw std::runtime_error( "Unsupported file extension" );

*this = ifstream( file, *container );

LOG(INFO) << __func__ << " done!";

}
`

@marcrambo
Copy link
Collaborator

Mp3 and Mp4 are currently not supported on Linux. On linux only wav, aiff, ogg and flac extensions are supported see https://github.com/NativeInstruments/ni-media/blob/master/audiostream/doc/ifstream.md.

The audio:.ifstream constructor will throw a runtime error when passing an unsupported file path, which is expected behavior. Client code should be using a try / catch block around the constructor and decide what to do in this case.

@lqniunjunlper
Copy link
Author

Thanks@marcrambo
Why Linux can not support mp4? Is there any plan for supporting mp4 on Linux?
Another question is how can we get meatadata of music, like sample-rate, bit-rate, artist,...

@lqniunjunlper
Copy link
Author

How to generate a new music audio from scratch, in which there is track name, artist, etc,...
More importantly it can be played in musicpalyer.

@FalconPDX
Copy link
Collaborator

@lqniunjunlper
ni-media does not generate audio, but simply streams it. If you're looking for metadata support, you should check out TagLib, which you can use alongside ni-media.

@FalconPDX
Copy link
Collaborator

FalconPDX commented Apr 15, 2020

Regarding your other comment about mp4 support, there was an initiative to integrate GStreamer into ni-media, which you can take a look at here: #11

@lqniunjunlper
Copy link
Author

@FalconPDX Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants