ffmpeg-libav-tutorial icon indicating copy to clipboard operation
ffmpeg-libav-tutorial copied to clipboard

error in transcoding audio from mp3 to aac

Open EdsionYeh opened this issue 2 years ago β€’ 2 comments

I tried 3_transcoding.c to transcode audio.

  StreamingParams sp = {0};
  sp.copy_audio = 0;
  sp.copy_video = 0;
  sp.video_codec = "libx264";
  sp.codec_priv_key = "x264-params";
  sp.codec_priv_value = "keyint=60:min-keyint=60:scenecut=0:force-cfr=1";
  sp.audio_codec = "aac";

The format of the input video file is as below.

  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 1718 kb/s, 30.20 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 255 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]

when transcoding from mp3 to aac, I got the error msg

[aac @ 0x55e811fab600] nb_samples (1152) > frame_size (1024)

EdsionYeh avatar Mar 30 '23 01:03 EdsionYeh

@EdsionYeh the msg you're posting as an error message seems to be a warn only, what was the output?

leandromoreira avatar Mar 30 '23 02:03 leandromoreira

with

  sp.copy_video = 1;

I got a bunch of such msgs and then Segmentation fault

[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
[aac @ 0x5633867f8a80] nb_samples (1152) > frame_size (1024)
Segmentation fault

The output file size looks reasonable, but it is not playable, It is very likely that av_write_trailer didn't get a chance to be called.

with

  sp.copy_video = 0;

I got

[aac @ 0x561f16315600] nb_samples (1152) > frame_size (1024)
[aac @ 0x561f16315600] nb_samples (1152) > frame_size (1024)
[aac @ 0x561f16315600] nb_samples (1152) > frame_size (1024)
[mp4 @ 0x561f15f32280] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 512 >= 0
LOG: Error -22 while receiving packet from decoder: Invalid argument

The output video file is only 48 bytes in size

EdsionYeh avatar Mar 30 '23 02:03 EdsionYeh