> On Sep 24, 2014, at 1:42 AM, sbwn <*@sbwn.fr> wrote:
>
> Hello,
> I'm trying to make a C++ program that convert music files, but it doesn't
> work.
>
> main.cpp : http://pastebin.com/kTN45Fn1 <http://pastebin.com/kTN45Fn1>
> functions.cpp : http://pastebin.com/aRwdHxy7 <http://pastebin.com/aRwdHxy7>
> Makefile : http://pastebin.com/BzBEBicH <http://pastebin.com/BzBEBicH>
> Program output :
> [mp3 @ 0x21eb200] max_analyze_duration reached
> Input #0, mp3, from 'test.mp3':
> Metadata:
> major_brand : mp42
> minor_version : 0
> compatible_brands: isommp42
> creation_time : 2013-11-29 03:30:21
> encoder : Lavf53.21.1
> Duration: 00:03:58.15, start: 0.000000, bitrate: 192 kb/s
> Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 192 kb/s
> Output #0, mp4, to 'out.mp4':
> Stream #0.0: Audio: libvorbis, 44100 Hz, stereo, s16, 192 kb/s
> [mp4 @ 0x21ee5c0] Codec for stream 0 does not use global headers but
> container format requires global headers
> audio encode error-22 Invalid argument
>
> avcodec_encode_audio2 returns -22 and the error string is "Invalid argument",
> I don't know more about the error
This isn’t going to solve your immediate problem, but I can give you one bit of
advice on any audio resampling operations you are performing, which gave me
fits for weeks. My problem was that after what appeared to be successful
resampling, I had a buzz that had been added to the audio. I tried all sorts of
machinations to fix this, to no avail. In the end, the problem was the rounding
function used (which was to round up, and which was employed in virtually every
resampling example I found in sample code, blogs, etc. on the Internet). Change
the function used to round down — this will prevent additives to your audio.
The logic behind this is probably self-explanatory if you think of the effect
to a sound wave by rounding up (adds data) versus down (removes data, albeit a
minimal amount).
A change of four characters in my code completely resolved the issue. Keep an
eye out for this if you are doing heavy resampling.
Good luck.
Brad
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user