<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 7 нояб. 2022 г., 19:40 Andrew Randrianasulu <<a href="mailto:randrianasulu@gmail.com">randrianasulu@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 7 нояб. 2022 г., 19:10 Andrew Randrianasulu <<a href="mailto:randrianasulu@gmail.com" target="_blank" rel="noreferrer">randrianasulu@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Because old thread now a bit too big for mobile gmail client.<div dir="auto"><br></div><div dir="auto">Yes, I'll try to see if it fails same way on my end. </div><div dir="auto"><br></div><div dir="auto">code seems to check first 100 frames</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div dir="auto">2528 static int field_probe(AVFormatContext *fmt_ctx, AVStream *st)</div><div dir="auto">2529 {</div><div dir="auto">2530 AVDictionary *copts = 0;</div><div dir="auto">2531 //av_dict_copy(&copts, opts, 0);</div><div dir="auto">2532 AVCodecID codec_id = st->codecpar->codec_id;</div><div dir="auto">2533 #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)</div><div dir="auto">2534 AVCodec *decoder = avcodec_find_decoder(codec_id);</div><div dir="auto">2535 #endif</div><div dir="auto">2536 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)</div><div dir="auto">2537 const AVCodec *decoder = avcodec_find_decoder(codec_id);</div><div dir="auto">2538 #endif</div><div dir="auto">2539 AVCodecContext *ctx = avcodec_alloc_context3(decoder);</div><div dir="auto">2540 if( !ctx ) {</div><div dir="auto">2541 fprintf(stderr,"codec alloc failed\n");</div><div dir="auto">2542 return -1;</div><div dir="auto">2543 }</div><div dir="auto">2544 avcodec_parameters_to_context(ctx, st->codecpar);</div><div dir="auto">2545 if( avcodec_open2(ctx, decoder, &copts) < 0 ) {</div><div dir="auto">2546 fprintf(stderr,"codec open failed\n");</div><div dir="auto">2547 return -1;</div><div dir="auto">2548 }</div><div dir="auto">2549 av_dict_free(&copts);</div><div dir="auto">2550 </div><div dir="auto">2551 AVFrame *ipic = av_frame_alloc();</div><div dir="auto">2552 AVPacket ipkt;</div><div dir="auto">2553 av_init_packet(&ipkt);</div><div dir="auto">2554 int ilaced = -1;</div><div dir="auto">2555 for( int retrys=100; --retrys>=0 && ilaced<0; ) {</div><div dir="auto">2556 av_packet_unref(&ipkt);</div><div dir="auto">2557 int ret = av_read_frame(fmt_ctx, &ipkt);</div><div dir="auto">2558 if( ret == AVERROR_EOF ) break;</div><div dir="auto">2559 if( ret != 0 ) continue;</div><div dir="auto">2560 if( ipkt.stream_index != st->index ) continue;</div><div dir="auto">2561 if( !ipkt.data || !ipkt.size ) continue;</div><div dir="auto">2562 ret = avcodec_send_packet(ctx, &ipkt);</div><div dir="auto">2563 if( ret < 0 ) {</div><div dir="auto">2564 fprintf(stderr, "avcodec_send_packet failed\n");</div><div dir="auto">2565 break;</div><div dir="auto">2566 }</div><div dir="auto">2567 ret = avcodec_receive_frame(ctx, ipic);</div><div dir="auto">2568 if( ret >= 0 ) {</div><div dir="auto">2569 ilaced = ipic->interlaced_frame ? 1 : 0;</div><div dir="auto">2570 break;</div><div dir="auto">2571 }</div><div dir="auto">2572 if( ret != AVERROR(EAGAIN) )</div><div dir="auto">2573 fprintf(stderr, "avcodec_receive_frame failed %d\n", ret);</div><div dir="auto">2574 }</div><div dir="auto">2575 av_packet_unref(&ipkt);</div><div dir="auto">2576 av_frame_free(&ipic);</div><div dir="auto">2577 avcodec_free_context(&ctx);</div><div dir="auto">2578 return ilaced;</div><div dir="auto"><br></div><div dir="auto">may be we can add flags to force interlaced vs progressive to bdwrite ... and/or debug why it fails.</div><div dir="auto"><br></div><div dir="auto"></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">sorry, not m2t or m2ts files were found on my main harddrive, so blind shot!</div><div dir="auto"><br></div><div dir="auto">Terje, can you recompile bdwrite with attached patch and see if it improves situation?</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">err, I think second patch also needed, because ilace in bdwrite is just 1/0/-1 not more detailed.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><div dir="auto"><br></div></div></div>
</blockquote></div></div></div>
</blockquote></div></div></div>