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

Error when using code from api2-remux.cpp sample. #130

Closed
akochkarev opened this issue Mar 8, 2024 · 9 comments
Closed

Error when using code from api2-remux.cpp sample. #130

akochkarev opened this issue Mar 8, 2024 · 9 comments

Comments

@akochkarev
Copy link

Hello!

I am trying to adapt this sample (api2-remux.cpp) for truncating audio files to needed duration without reencoding.

But facing next issue:
When coping streams

       // copy codec settings
        ocoder.copyContextFrom(icoder);

exception arises: "Codec context invalid"
and log says:
[NULL @ 0x562aaeddb780] copyContextFrom: Invalid target context

Log:

[wav @ 0x562aaed89fc0] Opening 'test.wav' for reading
[file @ 0x562aaed8b840] Setting default whitelist 'file,crypto,data'
[wav @ 0x562aaed89fc0] Before avformat_find_stream_info() pos: 80 bytes read:32768 seeks:0 nb_streams:1
[wav @ 0x562aaed89fc0] parser not found for codec pcm_f32le, packets or times may be invalid.
[wav @ 0x562aaed89fc0] parser not found for codec pcm_f32le, packets or times may be invalid.
[wav @ 0x562aaed89fc0] max_analyze_duration 5000000 reached at 5120000 microseconds st:0
[wav @ 0x562aaed89fc0] After avformat_find_stream_info() pos: 176208 bytes read:196608 seeks:0 frames:42
Input #0, wav, from 'test.wav':
  Duration: 00:00:14.45, bitrate: 256 kb/s
  Stream #0:0, 42, 1/8000: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 8000 Hz, 1 channels, flt, 256 kb/s
[NULL @ 0x562aaeddb780] copyContextFrom: Invalid target context
terminate called after throwing an instance of 'av::Exception'
  what():  Codec context invalid

Any ideas, what can be wrong here?
Thanks!

@h4tr3d
Copy link
Owner

h4tr3d commented Mar 8, 2024

Will look today

@h4tr3d
Copy link
Owner

h4tr3d commented Mar 9, 2024

@akochkarev , could you please check latest master code?

@akochkarev
Copy link
Author

akochkarev commented Mar 10, 2024

@h4tr3d , thanks for response!

I've tested api2-remux.cpp example from latest master sources today.
And now it works good.

But I see that there some new methods like Stream::codecParameters() was added and this breaks compatibility with v2.2.1 which I use from vcpkg currently.

Waiting for a new release :)
Thanks for a cool project!

@h4tr3d
Copy link
Owner

h4tr3d commented Mar 11, 2024

Oops... vcpkg... I forgot about them.

@h4tr3d
Copy link
Owner

h4tr3d commented Mar 11, 2024

vcpkg PR: microsoft/vcpkg#37366

Note, I rework the decode/encode functionality for now that breaks back compatibility. It will be released as v3.0.0. New functionality are required for more flexible using of the avcodec_send_XXX/avcode_receive_XXX approach.

@mojie126
Copy link

vcpkg PR: microsoft/vcpkg#37366

Note, I rework the decode/encode functionality for now that breaks back compatibility. It will be released as v3.0.0. New functionality are required for more flexible using of the avcodec_send_XXX/avcode_receive_XXX approach.

Great, does the new version support hardware encoding/decoding such as CUDA?

@h4tr3d
Copy link
Owner

h4tr3d commented Apr 15, 2024

does the new version support hardware encoding/decoding such as CUDA?

There is no any changes in this direction. But, it is still usable via direct FFmpeg usage (raw() method).

@mojie126
Copy link

I tested version 6.1, and it seems that it is not supported either, for example avcodec_register_all

@h4tr3d
Copy link
Owner

h4tr3d commented Apr 17, 2024

More details are needed.

@h4tr3d h4tr3d closed this as completed Apr 18, 2024
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