RocketNuts

Guest


  • #1

RocketNuts Asks: ffmpeg with libfdk_aac: AAC-HE-V2 profile doesn’t work for mono sound?
Whenever I use ffmpeg with libfdk_aac to convert a piece of audio to AAC, I noticed the aac_he_v2 profile does not work if the source audio is mono. For example:

Code:

ffmpeg -i mono.wav -c:a libfdk_aac -profile:a aac_he_v2 output.m4a

Gives an error:

Unable to initialize the encoder: SBR library initialization error
Error initializing output stream 0:0 — Error while opening encoder for output stream #0:0 – maybe incorrect parameters such as bit_rate, rate, width or height

I can overcome this by adding the -ac 2 option to force stereo. However it seems strange to me that this profile demands the audio to be stereo, whereas it works fine without specifying the AAC-HE-V2 profile. Maybe that’s my lack of understanding how this encoder or profile works, but is it supposed to be like that?

Furthermore I assume that by specifying -ac 2 ffmpeg will just ‘fake’ stereo by copying the single audio stream to an identical left and right channel?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Zach Huxford
  • Main forum
  • Replies: 0

Zach Huxford Asks: Why is it okay for my .bashrc or .zshrc to be writable by my normal user?
My user ~/.zshrc file has the following default privileges

My understanding of user permissions is that any process spawned by my user will then have read/write permissions to this file.

In malicious hands this could probably be used to edit aliases or append a directory of the attackers choosing to the beginning of the $PATH. I’m concerned that a malicious program that I install on the user level could then trick me into somehow giving up my sudo password through this method.

Obviously I do trust most of the programs that I install to not be malicious, however, I do use npm as a package manager for my own projects which is commonly accepted to be a vector for malware due to the sheer number of dependencies each module and it’s dependencies can have.

I know that running sudo npm install -g is really bad practice but is using npm as a user which has write access to your main shell configuration file almost as bad just with a few extra steps in between, or am I lacking an understanding of how user permissions/shell configuration/npm works?

If this is insecure, then have I somehow missed security good practice for handling node js projects?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Amal P Ramesh
  • Main forum
  • Replies: 0

Amal P Ramesh Asks: SFTP user login details real-time filtering
I have enabled the SFTP login log into the default logfile /var/log/syslog and tried to filter the login time of each user and insert it into the database.

But the filtering is not worked as I expected.

Sample log file:

Code:

Jun 23 15:47:03 ip-172-16-0-62 systemd[24938]: Reached target Shutdown.
Jun 23 15:47:03 ip-172-16-0-62 systemd[24938]: Starting Exit the Session..c.
Jun 23 15:47:03 ip-172-16-0-62 systemd[24938]: Received SIGRTMIN+24 from PID 24980 (kill).
Jun 23 15:47:03 ip-172-16-0-62 systemd[1]: Stopped User Manager for UID 1051.
Jun 23 15:47:03 ip-172-16-0-62 systemd[1]: Removed slice User Slice of nidasu.
Jun 23 15:47:13 ip-172-16-0-62 systemd[1]: Created slice User Slice of ftpuser1.
Jun 23 15:47:13 ip-172-16-0-62 systemd[1]: Starting User Manager for UID 1069...
Jun 23 15:47:13 ip-172-16-0-62 systemd[1]: Started Session 11907571 of user ftpuser1.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Listening on REST API socket for snapd user session agent.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Reached target Paths.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Reached target Timers.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Reached target Sockets.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Reached target Basic System.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Reached target Default.
Jun 23 15:47:13 ip-172-16-0-62 systemd[24987]: Startup finished in 15ms.

Needs to filter user login messages, like:

Code:

Jun 23 15:47:13 ip-172-16-0-62 systemd[1]: Started Session 11907571 of user ftpuser1.

I need to grep it out by matching the string “Started Session 11907571 of user ftpuser1

The session number 11907571 is a random number and usernames also differ so grepping can ignore the numbers and usernames, only need to check the string like: **”Started Session *** of user ***”

And need to parse the line and grep the date + time, and username then insert it into the MySQL database.

If there is any option to create a daemon process to run and insert the details into DB, it will help me to do the task.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • gyandoo
  • Main forum
  • Replies: 0

gyandoo Asks: get nat port forwarding IP address
I am using an android phone that is connected to an openwrt router via usb tether

The android phone has a dynamic wan gateway on each reboot

To make things easy for me to connect to the webui of some of the apps on the android phone via the openwrt router, I created a port forwarding rule in openwrt and entered the wan ip of the android phone manually. port forwarding rule

On each reboot of the android phone, i will have to check the routes in openwrt, get the new wan ip and update the port forwarding rule, which is fine

to make things easier on my linux machine, id like to be able to use CLI to get that wan ip that i set in port forwarding i.e 192.168.1.1:32399

not that it matters, but curlftpfs ftp mounting isn’t playing well with nat, all other android app webui’s are working fine with the port redirect, curlftpfs requires the wan ip, it finds the wan ip in debug but skips it

thanks

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Mithilesh
  • Main forum
  • Replies: 0

Mithilesh Asks: Using docker does not give error with sudo but using ctr does on starting a container
I am starting a container using the docker run command, it works fine. However when I try to start the same container using ctr command (irrespective of whatever snapshotter I use) I get this error:

Code:

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

The error is coming from one of the lines in the dockerfile which is prepended by sudo . Please note that I tried removing sudo but then it gives permission denied error. As per my understanding docker engine uses ctr under the hood. Then why does not working for ctr? How shall I proceed to de

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Bryan Fury
  • Main forum
  • Replies: 0

Bryan Fury Asks: What are some of the latest Nike soccer shoes that have gained popularity among players and enthusiasts in recent years?
In recent years, the Nike Mercurial Vapor XI NJR soccer shoes have gained significant popularity among players and enthusiasts. These cleats, also known as the “Neymar edition”, are renowned for their explosive speed and agility on the field. With a lightweight and streamlined design, the Nike Mercurial Vapor allows players to move swiftly and effortlessly. Equipped with innovative technology and high-quality materials, these cleats offer exceptional traction and responsiveness, making them a top choice for players seeking optimal performance. The sleek aesthetic of the Nike Mercurial Vapor XI NJR, inspired by Neymar Jr., one of the world’s top soccer players, has contributed to their widespread acclaim among soccer enthusiasts.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • AbdelKh
  • Main forum
  • Replies: 0

AbdelKh Asks: Can’t change TCP/IPv4 settings on windows 10
As I am trying to change my wireless IPv4 or DNS IP address, everything goes well until I click OK.

The adapter window pops up this error: "An unexpected condition occurred. Not all of your requested changes in settings could be made"

Picture of the error message

Even when I restored Windows, disabled and re enabled the adapter, the problem was not solved.

Any help would be appreciated.

Edit: I fixed that by resetting Windows 10. No other solution worked for me.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • tintincutes
  • Main forum
  • Replies: 0

tintincutes Asks: Customer service access 2007 template
anybody is familiar with this? can you please help me understand where can I find the other tables, Cases_1 and Employees_1? If I click on the relationship I can see these tables but I can’t see that on the Main Page? are they some kind of being hidden?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

ffmpeg -y -i ArjunReddy.mp4 -c:a libfdk_aac -profile:a aac_he_v2 audio.aac
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-nonfree
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ArjunReddy.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : www.movierulz.ms
    encoder         : Lavf57.71.100
  Duration: 03:01:42.99, start: 0.000000, bitrate: 1125 kb/s
    Stream #0:0(tel): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x544 [SAR 1:1 DAR 40:17], 990 kb/s, 20.31 fps, 16k tbr, 16k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(tel): Audio: ac3 (ac-3 / 0x332D6361), 44100 Hz, 5.1(side), fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      audio service type: main
Stream mapping:
  Stream #0:1 -> #0:0 (ac3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[libfdk_aac @ 0x7fd9a5801800] Unable to initialize the encoder: SBR library initialization error
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

This article will perform AAC coding combat through two ways and programming. The encoding library used is libfdk_aac.

Require

FDK-AAC has the input PCM data.Parameter requirementsIf the parameters are wrong, the following errors will occur:

[libfdk_aac @ 0x7fa3db033000] Unable to initialize the encoder: SBR library initialization error
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

Sampling

It must be 16 -bit integer PCM.

Sampling Rate

The support sampling rate is (Hz):

  • 8000、11025、12000、16000、22050、24000、32000
  • 44100、48000、64000、88200、96000

Command Line

Basic use

The simplest usage is as follows:

# pcm -> aac
ffmpeg -ar 44100 -ac 2 -f s16le -i in.pcm -c:a libfdk_aac out.aac

# wav -> aac
 # In order to simplify the instructions, this article will try to use in.wav to replace in.pcm later
ffmpeg -i in.wav -c:a libfdk_aac out.aac
  • -ar 44100 -ac 2 -f s16le

    • PCM input data parameters
  • -c:a

    • Set audio encoder
    • cIndicates codec (compilation code),aExpress Audio (audio)
    • Equivalent
      • -codec:a
      • -acodec
    • It should be noted that this parameter should be written on the AAC file, that is, it belongs toOutputparameter

The AAC file generated by the default is the LC specification.

ffprobe out.aac

 # Output results are shown below
Audio: aac (LC), 44100 Hz, stereo, fltp, 120 kb/s

Common parameters

  • -b:a
    • Set out the output bit rate
    • For example*-b: A 96K*
ffmpeg -i in.wav -c:a libfdk_aac -b:a 96k out.aac
  • -profile:a
    • Set output specifications
    • The value is:
      • aac_low:Low Complexity AAC (LC),Defaults
      • aac_he:High Efficiency AAC (HE-AAC)
      • aac_he_v2:High Efficiency AAC version 2 (HE-AACv2)
      • aac_ld:Low Delay AAC (LD)
      • aac_eld:Enhanced Low Delay AAC (ELD)
    • Once the output specifications are set, a suitable output bit rate will be automatically set
      • You can also use*-b: A*Set the output bit rate by yourself
ffmpeg -i in.wav -c:a libfdk_aac -profile:a aac_he_v2 -b:a 32k out.aac
  • -vbr
    • OpenVBRMode (Variable Bit Rate)
    • If the VBR mode is turned on,-b:aThe option will be ignored, but*-profile: A*option is still valid
    • The range range is 0 ~ 5
      • 0:Defaults, Turn off the VBR mode and turn on the CBR mode
      • 1: The lowest quality (but the sound quality is still great)
      • 5: The highest quality
VBR kbps/channel AOTs
1 20-32 LC、HE、HEv2
2 32-40 LC、HE、HEv2
3 48-56 LC、HE、HEv2
4 64-72 LC
5 96-112 LC

AOT is the abbreviation of Audio Object Type.

ffmpeg -i in.wav -c:a libfdk_aac -vbr 1 out.aac

file format

I was”Reconstruction Audio”Mentioned that there are three main types of file expansion of AAC codes: AAC, M4A, MP4.

# m4a
ffmpeg -i in.wav -c:a libfdk_aac out.m4a

# mp4
ffmpeg -i in.wav -c:a libfdk_aac out.mp4

Programming

AAC encoding process:
aac编码流程

2 libraries need to be used:

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
}

 // Error treatment
#define ERROR_BUF(ret) \
    char errbuf[1024]; \
    av_strerror(ret, errbuf, sizeof (errbuf));

Functional declaration

We will eventually encapsulate the PCM to AAC operation into a function.

extern "C" {
#include <libavcodec/avcodec.h>
}

 // parameters
typedef struct {
    const char *filename;
    int sampleRate;
    AVSampleFormat sampleFmt;
    int chLayout;
} AudioEncodeSpec;

class FFmpegUtil {
public:
    FFmpegUtil();

    static void aacEncode(AudioEncodeSpec &in,
                          const char *outFilename);
};

Function implementation

Variable definitions

// Encoder 
AVCodec *codec = nullptr;
 // context
AVCodecContext *ctx = nullptr;

 // Used to store data before coding
AVFrame *frame = nullptr;
 // Used to store data after encoding
AVPacket *pkt = nullptr;

 // Back results
int ret = 0;

 // Enter file
QFile inFile(in.filename);
 // Output file
QFile outFile(outFilename);

Get the encoder

The following code can get the default AAC encoder (not libfdk_aac) of FFMPEG.

AVCodec *codec1 = avcodec_find_encoder(AV_CODEC_ID_AAC);

AVCodec *codec2 = avcodec_find_encoder_by_name("aac");

// true
qDebug() << (codec1 == codec2);

// aac
qDebug() << codec1->name;

But what we have to get in the end is libfdk_aac.

// Get FDK-AAC encoder
codec = avcodec_find_encoder_by_name("libfdk_aac");
if (!codec) {
    qDebug() << "encoder libfdk_aac not found";
    return;
}

Check the sampling format

Next check whether the encoder supports the current sampling format.

// Check the sampling format
if (!check_sample_fmt(codec, in.sampleFmt)) {
    qDebug() << "Encoder does not support sample format"
             << av_get_sample_fmt_name(in.sampleFmt);
    return;
}

Check the functioncheck_sample_fmtThe implementation is as shown below.

// Check whether the encoder CODEC supports sample_fmt
static int check_sample_fmt(const AVCodec *codec,
                            enum AVSampleFormat sample_fmt) {
    const enum AVSampleFormat *p = codec->sample_fmts;
    while (*p != AV_SAMPLE_FMT_NONE) {
        if (*p == sample_fmt) return 1;
        p++;
    }
    return 0;
}

Create context

avcodec_alloc_context3Back3It shows that this is already the 3rd edition API, which replaces the previous oneavcodec_alloc_contextandavcodec_alloc_context2

// Create the context
ctx = avcodec_alloc_context3(codec);
if (!ctx) {
    qDebug() << "avcodec_alloc_context3 error";
    return;
}

 // Setting parameters 
ctx->sample_fmt = in.sampleFmt;
ctx->sample_rate = in.sampleRate;
ctx->channel_layout = in.chLayout;
 // bit rate
ctx->bit_rate = 32000;
 // Specification 
ctx->profile = FF_PROFILE_AAC_HE_V2;

Open the encoder

// Open the encoder
ret = avcodec_open2(ctx, codec, nullptr);
if (ret < 0) {
    ERROR_BUF(ret);
    qDebug() << "avcodec_open2 error" << errbuf;
    goto end;
}

If you want to set some parameters (such as VBR) unique to libfdk_aac, you can pass through the Options parameter.

AVDictionary *options = nullptr;
av_dict_set(&options, "vbr", "1", 0);
ret = avcodec_open2(ctx, codec, &options);

Create avframe

Avframe is used to store data before coding.

// Create avframe
frame = av_frame_alloc();
if (!frame) {
    qDebug() << "av_frame_alloc error";
    goto end;
}

 // The number of sample frames (determined by Frame_size)
frame->nb_samples = ctx->frame_size;
 // Sample format
frame->format = ctx->sample_fmt;
 // channel layout
frame->channel_layout = ctx->channel_layout;
 // Create a buffer inside AVFRAME
ret = av_frame_get_buffer(frame, 0);
if (ret < 0) {
    ERROR_BUF(ret);
    qDebug() << "av_frame_get_buffer error" << errbuf;
    goto end;
}

Create AVPacket

// Create AVPACKET
pkt = av_packet_alloc();
if (!pkt) {
    qDebug() << "av_packet_alloc error";
    goto end;
}

open a file

// open a file 
if (!inFile.open(QFile::ReadOnly)) {
    qDebug() << "file open error" << in.filename;
    goto end;
}
if (!outFile.open(QFile::WriteOnly)) {
    qDebug() << "file open error" << outFilename;
    goto end;
}

Start coding

// Frame-> LineSize [0] is the size of the buffer
 // Read file data
while ((ret = inFile.read((char *) frame->data[0],
                          frame->linesize[0])) > 0) {
         // When reading the file data for the last time, it may not be filled with Frame's buffer
    if (ret < frame->linesize[0]) {
                 // channel number
        int chs = av_get_channel_layout_nb_channels(frame->channel_layout);
                 // The size of each sample
        int bytes = av_get_bytes_per_sample((AVSampleFormat) frame->format);
                 // Change to the real and effective number of sample frames
        frame->nb_samples = ret / (chs * bytes);
    }

         // code
    if (encode(ctx, frame, pkt, outFile) < 0) {
        goto end;
    }
}

 // Flush encoder
encode(ctx, nullptr, pkt, outFile);

encodeThe function is specifically used for coding, and its implementation is shown below.

// audio coding
 // Return to negative numbers: errors occur in the middle
 // Return 0: Code operation is completed normally
static int encode(AVCodecContext *ctx,
                  AVFrame *frame,
                  AVPacket *pkt,
                  QFile &outFile) {
         // Send data to encoder
    int ret = avcodec_send_frame(ctx, frame);
    if (ret < 0) {
        ERROR_BUF(ret);
        qDebug() << "avcodec_send_frame error" << errbuf;
        return ret;
    }

    while (true) {
                 // Get the encoded data from the encoder
        ret = avcodec_receive_packet(ctx, pkt);
                 // Packet has no data, you need to send data to the encoder (Send Frame)
        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
            return 0;
                 } else if (RET <0) {// Other errors appear
            ERROR_BUF(ret);
            qDebug() << "avcodec_receive_packet error" << errbuf;
            return ret;
        }

                 // Write the encoded data into the file
        outFile.write((char *) pkt->data, pkt->size);

                 // Release resources
        av_packet_unref(pkt);
    }

    return 0;
}

Recycle

end:
         // Close the file
    inFile.close();
    outFile.close();

         // Release resources
    av_frame_free(&frame);
    av_packet_free(&pkt);
    avcodec_free_context(&ctx);

Function call

#ifdef Q_OS_WIN
         // The file name of the pcm file
    #define IN_FILENAME "../test/44100_s16le_2.pcm"
    #define OUT_FILENAME "../test/out.aac"
#else
    #define IN_FILENAME "/Users/zuojie/QtProjects/audio-video-dev/test/44100_s16le_2.pcm"
    #define OUT_FILENAME "/Users/zuojie/QtProjects/audio-video-dev/test/out.acc"
#endif

AudioEncodeSpec in;
in.filename = IN_FILENAME;
in.sampleFmt = AV_SAMPLE_FMT_S16;
in.sampleRate = 44100;
in.chLayout = AV_CH_LAYOUT_STEREO;

FFmpegUtil::aacEncode(in,OUT_FILENAME);

Notice

In the whole coding step above the whole loop, there is no following code running code to generate OUT1.AAC file

// When reading the file data for the last time, it may not be filled with Frame's buffer
if (ret < frame->linesize[0]) {
         // channel number
    int chs = av_get_channel_layout_nb_channels(frame->channel_layout);
         // The size of each sample
    int bytes = av_get_bytes_per_sample((AVSampleFormat) frame->format);
         // Change to the real and effective number of sample frames
    frame->nb_samples = ret / (chs * bytes);
}

Then we are using the FFMPEG command to generate out2.aac files

ffmpeg -ar 44100 -ac 2 -f s16le -i 44100_s16le_2.pcm -c:a libfdk_aac -b:a 32k -profile:a aac_he_v2 out2.aac


You can find 5 more bytes generated by the FFMPEG command generated in the code. What is going on? This is because when reading the PCM file, when the last time I read it, fill in the AVFRAME cache area. For example The 4096 bytes of the full buffer area, so when sending the encoder, the encoder directly encodes the 4096 of the buffer, which will cause excess invalid bytes.

Code link

Whenever I use ffmpeg with libfdk_aac to convert a piece of audio to AAC, I noticed the aac_he_v2 profile does not work if the source audio is mono. For example:

ffmpeg -i mono.wav -c:a libfdk_aac -profile:a aac_he_v2 output.m4a

Gives an error:

Unable to initialize the encoder: SBR library initialization error
Error initializing output stream 0:0 — Error while opening encoder for output stream #0:0 – maybe incorrect parameters such as bit_rate, rate, width or height

I can overcome this by adding the -ac 2 option to force stereo. However it seems strange to me that this profile demands the audio to be stereo, whereas it works fine without specifying the AAC-HE-V2 profile. Maybe that’s my lack of understanding how this encoder or profile works, but is it supposed to be like that?

Furthermore I assume that by specifying -ac 2 ffmpeg will just ‘fake’ stereo by copying the single audio stream to an identical left and right channel?

Constant fdk_aac_sys::AACENC_ERROR_AACENC_INIT_SBR_ERROR

source ·

pub const AACENC_ERROR_AACENC_INIT_SBR_ERROR: AACENC_ERROR = 66;

Expand description

< SBR library initialization error.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *