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

The Matroska muxer does not yet support muxing cook #1300

Closed
deTian0 opened this issue Jan 15, 2025 · 1 comment
Closed

The Matroska muxer does not yet support muxing cook #1300

deTian0 opened this issue Jan 15, 2025 · 1 comment
Labels
state:Done This issue has been resolved/dismissed type:Enhancement New feature or request

Comments

@deTian0
Copy link

deTian0 commented Jan 15, 2025

Describe the bug
A clear and concise description of the bug.
The Matroska muxer does not yet support muxing cook
Matroska muxer 尚不支持 muxing cook

To Reproduce
Steps to reproduce the behavior:

使用音频编码为 cook 的 视频
Use audio encoded as cook for the video

Expected behavior
A clear and concise description of what you expected to happen.

Actual behavior
A clear and concise description of what actually happened.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Environment:

  • OS: Windows 11
  • GPU: NVIDIA GeForce RTX 4060ti
  • Video2X Version: 6.3.1

Full command
If applicable, add the full command you used to run the program.

Additional context
Add any other context about the problem here.

[2025-01-15 20:52:28] [info] Starting Video2X Qt6 6.3.1
[2025-01-15 20:53:58] [error] [FFmpeg] [rm @ 000001e05e658f80] Invalid stream index 2 for index at pos 134338399
[2025-01-15 20:53:58] [info] [FFmpeg] [libx264 @ 000001e05e69c140] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2025-01-15 20:53:58] [info] [FFmpeg] [libx264 @ 000001e05e69c140] profile High, level 5.0, 4:2:0, 8-bit
[2025-01-15 20:53:58] [info] [FFmpeg] [libx264 @ 000001e05e69c140] 264 - core 164 r3192 c24e06c - H.264/MPEG-4 AVC codec - Copyleft 2003-2024 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[2025-01-15 20:53:58] [error] [FFmpeg] [matroska @ 000001e066c85c00] The Matroska muxer does not yet support muxing cook
[2025-01-15 20:53:58] [error] Error writing output file header
[2025-01-15 20:53:58] [critical] Failed to initialize encoder: Not yet implemented in FFmpeg, patches welcome
@deTian0 deTian0 added the type:Bug Something isn't working label Jan 15, 2025
@github-actions github-actions bot added the state:Backlog This issue will be worked on in the future label Jan 15, 2025
@deTian0 deTian0 changed the title <Bug summary> The Matroska muxer does not yet support muxing cook Jan 15, 2025
@k4yt3x
Copy link
Owner

k4yt3x commented Jan 15, 2025

That's the expected behavior right now, since the program only copies the audio streams without any re-encoding:

video2x/src/libvideo2x.cpp

Lines 262 to 267 in 031c0a7

} else if (enc_cfg_.copy_streams && stream_map[packet->stream_index] >= 0) {
ret = write_raw_packet(packet.get(), ifmt_ctx, ofmt_ctx, stream_map);
if (ret < 0) {
return ret;
}
}

video2x/src/libvideo2x.cpp

Lines 320 to 342 in 031c0a7

int VideoProcessor::write_raw_packet(
AVPacket* packet,
AVFormatContext* ifmt_ctx,
AVFormatContext* ofmt_ctx,
int* stream_map
) {
char errbuf[AV_ERROR_MAX_STRING_SIZE];
int ret = 0;
AVStream* in_stream = ifmt_ctx->streams[packet->stream_index];
int out_stream_idx = stream_map[packet->stream_index];
AVStream* out_stream = ofmt_ctx->streams[out_stream_idx];
av_packet_rescale_ts(packet, in_stream->time_base, out_stream->time_base);
packet->stream_index = out_stream_idx;
ret = av_interleaved_write_frame(ofmt_ctx, packet);
if (ret < 0) {
av_strerror(ret, errbuf, sizeof(errbuf));
logger()->critical("Error muxing audio/subtitle packet: {}", errbuf);
}
return ret;
}

In order to support ANY codec, we'll need to also implement an encoder for the audio streams. It can be done but will require extra work. You can try changing to a container that supports the cook codec or let v2x to not copy the audio stream for now:

image

@k4yt3x k4yt3x added type:Enhancement New feature or request and removed type:Bug Something isn't working labels Jan 15, 2025
@k4yt3x k4yt3x closed this as completed Jan 18, 2025
@github-actions github-actions bot added state:Done This issue has been resolved/dismissed and removed state:Backlog This issue will be worked on in the future labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:Done This issue has been resolved/dismissed type:Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants