[Cin] New thread on bdwrite + mpeg2 HDV video

Andrew Randrianasulu randrianasulu at gmail.com
Tue Nov 8 03:18:49 CET 2022


so my  two patches tested on desktop with Terje's input file made it into
playble by mplayer output


bdwrite how reports

warning bdwrite uses field into from stream

so, more testing needed!

вт, 8 нояб. 2022 г., 04:33 Andrew Randrianasulu <randrianasulu at gmail.com>:

>
>
> вт, 8 нояб. 2022 г., 00:36 Terje J. Hanssen <terjejhanssen at gmail.com>:
>
>>
>>
>> Den 07.11.2022 21:32, skrev Andrew Randrianasulu:
>>
>>
>>
>> пн, 7 нояб. 2022 г., 23:12 Terje J. Hanssen <terjejhanssen at gmail.com>:
>>
>>>
>>>
>>> Den 07.11.2022 19:31, skrev Andrew Randrianasulu:
>>>
>>>
>>>
>>> пн, 7 нояб. 2022 г., 21:27 Terje J. Hanssen <terjejhanssen at gmail.com>:
>>>
>>>>
>>>>
>>>> Den 07.11.2022 18:58, skrev Andrew Randrianasulu:
>>>>
>>>>
>>>>
>>>> пн, 7 нояб. 2022 г., 20:50 Andrew Randrianasulu <
>>>> randrianasulu at gmail.com>:
>>>>
>>>>>
>>>>>
>>>>> пн, 7 нояб. 2022 г., 20:30 Andrew Randrianasulu <
>>>>> randrianasulu at gmail.com>:
>>>>>
>>>>>>
>>>>>>
>>>>>> пн, 7 нояб. 2022 г., 19:40 Andrew Randrianasulu <
>>>>>> randrianasulu at gmail.com>:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> пн, 7 нояб. 2022 г., 19:10 Andrew Randrianasulu <
>>>>>>> randrianasulu at gmail.com>:
>>>>>>>
>>>>>>>> Because old thread  now a bit too big for mobile gmail  client.
>>>>>>>>
>>>>>>>
>>>> Yes, I also discovered that and thougt we should continue on another
>>>> thread
>>>> (though Thunderbird/IMAP on my Ultrabook had no problems)
>>>>
>>>>
>>>>
>>>>>>>> Yes, I'll try to see if it fails same way on my end.
>>>>>>>>
>>>>>>>> code seems to check first 100 frames
>>>>>>>>
>>>>>>>>
>>>>>>>> 2528 static int field_probe(AVFormatContext *fmt_ctx, AVStream *st)
>>>>>>>> 2529 {
>>>>>>>> 2530   AVDictionary *copts = 0;
>>>>>>>> 2531   //av_dict_copy(&copts, opts, 0);
>>>>>>>> 2532   AVCodecID codec_id = st->codecpar->codec_id;
>>>>>>>> 2533 #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
>>>>>>>> 2534   AVCodec *decoder = avcodec_find_decoder(codec_id);
>>>>>>>> 2535 #endif
>>>>>>>> 2536 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
>>>>>>>> 2537   const AVCodec *decoder = avcodec_find_decoder(codec_id);
>>>>>>>> 2538 #endif
>>>>>>>> 2539   AVCodecContext *ctx = avcodec_alloc_context3(decoder);
>>>>>>>> 2540   if( !ctx ) {
>>>>>>>> 2541     fprintf(stderr,"codec alloc failed\n");
>>>>>>>> 2542     return -1;
>>>>>>>> 2543   }
>>>>>>>> 2544   avcodec_parameters_to_context(ctx, st->codecpar);
>>>>>>>> 2545   if( avcodec_open2(ctx, decoder, &copts) < 0 ) {
>>>>>>>> 2546     fprintf(stderr,"codec open failed\n");
>>>>>>>> 2547     return -1;
>>>>>>>> 2548   }
>>>>>>>> 2549   av_dict_free(&copts);
>>>>>>>> 2550
>>>>>>>> 2551   AVFrame *ipic = av_frame_alloc();
>>>>>>>> 2552   AVPacket ipkt;
>>>>>>>> 2553   av_init_packet(&ipkt);
>>>>>>>> 2554   int ilaced = -1;
>>>>>>>> 2555   for( int retrys=100; --retrys>=0 && ilaced<0; ) {
>>>>>>>> 2556     av_packet_unref(&ipkt);
>>>>>>>> 2557     int ret = av_read_frame(fmt_ctx, &ipkt);
>>>>>>>> 2558     if( ret == AVERROR_EOF ) break;
>>>>>>>> 2559     if( ret != 0 ) continue;
>>>>>>>> 2560     if( ipkt.stream_index != st->index ) continue;
>>>>>>>> 2561     if( !ipkt.data || !ipkt.size ) continue;
>>>>>>>> 2562     ret = avcodec_send_packet(ctx, &ipkt);
>>>>>>>> 2563     if( ret < 0 ) {
>>>>>>>> 2564       fprintf(stderr, "avcodec_send_packet failed\n");
>>>>>>>> 2565       break;
>>>>>>>> 2566     }
>>>>>>>> 2567     ret = avcodec_receive_frame(ctx, ipic);
>>>>>>>> 2568     if( ret >= 0 ) {
>>>>>>>> 2569       ilaced = ipic->interlaced_frame ? 1 : 0;
>>>>>>>> 2570       break;
>>>>>>>> 2571     }
>>>>>>>> 2572     if( ret != AVERROR(EAGAIN) )
>>>>>>>> 2573       fprintf(stderr, "avcodec_receive_frame failed %d\n",
>>>>>>>> ret);
>>>>>>>> 2574   }
>>>>>>>> 2575   av_packet_unref(&ipkt);
>>>>>>>> 2576   av_frame_free(&ipic);
>>>>>>>> 2577   avcodec_free_context(&ctx);
>>>>>>>> 2578   return ilaced;
>>>>>>>>
>>>>>>>> may be we can add flags to force interlaced vs progressive to
>>>>>>>> bdwrite ... and/or debug why it fails.
>>>>>>>>
>>>>>>>>
>>>>>>> sorry, not m2t or m2ts files were found on my main harddrive, so
>>>>>>> blind shot!
>>>>>>>
>>>>>>> Terje, can you recompile bdwrite with attached patch and see if it
>>>>>>> improves situation?
>>>>>>>
>>>>>>
>>>> I hope to avoid recompiling my ultrabook, where I just have installed
>>>> the CinGG appimage
>>>>
>>>>
>>>>
>>>>>>
>>>>>> err, I think second patch also needed, because ilace in bdwrite is
>>>>>> just 1/0/-1 not more detailed.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> finally found m2t file, for me bdwrite does not complain but resulting
>>>>> file is unplayable
>>>>>
>>>>
>>>> Note:
>>>> I just used the short m2t file you linked to; maybe it is to short for
>>>> interlace probe?
>>>>
>>>
>>>
>>> may be! try to cp it under few different names then cat them together to
>>> get longer file?
>>>
>>>
>>>
>>>>
>>>> this one contain real very short hdv sample with mp2 sound
>>>> http://twenkid.com/os/3.m2t
>>>>
>>>>
>>>>
>>>>>
>>>>> note I used -b switch for new mkudffs so it works with 2048 blocks and
>>>>> not default 512
>>>>>
>>>>
>>>> I used the plain manual step 3 without -b, as also used for 2048 blocks
>>>> in the sample step 2 ?
>>>> I 'll do a new attempt with -b and reort the result
>>>>
>>>>
>>>>
>>>>> root at slax:/tmp# mkudffs -b 2048 /tmp/newfilename.udfs 25915
>>>>>    filename=/tmp/newfilename.udfs
>>>>> label=LinuxUDF
>>>>> uuid=6369651cdf849fbf
>>>>> blocksize=2048
>>>>> blocks=25915
>>>>> udfrev=2.01
>>>>> start=0, blocks=16, type=ERASE
>>>>> start=16, blocks=4, type=VRS
>>>>> start=20, blocks=76, type=ERASE
>>>>> start=96, blocks=16, type=MVDS
>>>>> start=112, blocks=16, type=ERASE                              start=128,
>>>>> blocks=4, type=LVID                                start=132, blocks=124,
>>>>> type=ERASE                        start=256, blocks=1, type=ANCHOR
>>>>>
>>>>> start=257, blocks=25400, type=PSPACE      start=25657, blocks=1,
>>>>> type=ERASE
>>>>> start=25658, blocks=1, type=ANCHOR
>>>>> start=25659, blocks=69, type=ERASE
>>>>>  start=25728, blocks=16, type=RVDS
>>>>>  start=25744, blocks=170, type=ERASE
>>>>> start=25914, blocks=1, type=ANCHOR
>>>>> root at slax:/tmp# mount -o loop /tmp/newfilename.udfs /mnt/test
>>>>>
>>>>>
>>>>> root at slax:/tmp# bdwrite /mnt/test /home/guest/20081103140154.m2t
>>>>>
>>>>>
>>>>> root at slax:/tmp# umount /mnt/test
>>>>>
>>>>>
>>>>>
>>>>> playing result in many
>>>>>
>>>>> root at slax:/tmp# mplayer -vo null br://tmp/newfilename.udfs
>>>>>   MPlayer UNKNOWN-11.2.0 (C) 2000-2022 MPlayer Team
>>>>>  do_connect: could not connect to socket
>>>>>  connect: No such file or directory
>>>>>  Failed to open LIRC support. You will not be able to use your remote
>>>>> control.
>>>>>
>>>>>  Playing br://tmp/newfilename.udfs.                                     The
>>>>> hostname option must be an integer: tmp              Struct bluray, field
>>>>> hostname parsing error: tmp             libavformat version 59.33.100
>>>>> (internal)                           bluray.c:707: Skipping broken unit at
>>>>> 0                              bluray.c:255: 00000.m2ts: no timestamp for
>>>>> SPN 0 (got 0). clip 46909800-47511000.
>>>>>  bluray.c:707: Skipping broken unit at 0
>>>>> bluray.c:707: Skipping broken unit at 6144
>>>>> bluray.c:255: 00000.m2ts: no timestamp for SPN 0 (got 0). clip
>>>>> 46909800-47511000.                                       bluray.c:707:
>>>>> Skipping broken unit at 0                               bluray.c:707:
>>>>> Skipping broken unit at 6144                     bluray.c:707: Skipping
>>>>> broken unit at 12288                    bluray.c:707: Skipping broken unit
>>>>> at 18432                    bluray.c:707: Skipping broken unit at 24576
>>>>>
>>>>> {and so on}
>>>>>
>>>>
>>>>
>>>> on the other hand reencoding audio like this
>>>>
>>>> root at slax:/tmp# ffmpeg -i /home/guest/20081103140154.m2t -c:v copy
>>>> -c:a ac3 -b:a 384k 2008.m2ts
>>>>
>>>> and repeating steps with mkudffs / mount /bdwrite /umount resulted in
>>>> working in mplayer file!
>>>>
>>>> I have 'old' 4.4 ffmpeg, so no bluray encoding for me.
>>>>
>>>> also, I used wcalc as console calc
>>>>
>>>>
>>>>
>>>>
>>> I discovered I had wrong calculated the file size in kb instead of
>>> bytes, but this didn't change anything,
>>>
>>> I attach my 8.7 Mb (small) output.mts with pcm_bluray audio created with
>>> ffmpeg-5.1.2 on Tumleweed, so you can try it.
>>>
>>
>>
>> thanks, I just copied m2ts file from my desktop vua ssh to my tablet, run
>> ffmpeg 5.1.2 on it, moved result back to desktop and created bd - no error
>> ...
>>
>> it also play in mplayer and it says
>>
>> Selected audio codec: [fflpcm] afm: ffmpeg (Blu-ray LPCM)
>>
>>
>>
>> procedure on filecopy
>>
>> ~ $ scp guest at 192.168.1.102:/home/guest/20081103140154.m2t .
>>
>>
>> note dot at the end, I copied in current folder
>>
>>
>> ~ $ ffmpeg -i 20081103140154.m2t -c:v copy -c:a pcm_bluray 2008_pcm.m2ts
>>
>>
>> ~ $ mpv 2008_pcm.m2ts
>>      Video --vid=1 (mpeg2video 1440x1080 25.000fps)
>>  (+) Audio --aid=1 (pcm_bluray 2ch 48000Hz)
>> AO: [opensles] 48000Hz stereo 2ch s16
>> A: 00:00:13 / 00:00:13 (97%)
>>
>> Exiting... (End of file)
>> ~ $ scp 2008_pcm.m2ts guest at 192.168.1.102:/home/guest
>> guest at 192.168.1.102's password:
>> 2008_pcm.m2ts                         100%   45MB   5.8MB/s   00:07
>>
>>
>> and via ssh on desktop (102):
>>
>> root at slax:/tmp# du -sb 2008_pcm.m2ts
>> 47020032        2008_pcm.m2ts                                root at slax:/tmp#
>> mkudffs -b 2048 /tmp/newfilename.udfs 27055
>>
>> root at slax:/tmp# mount -o loop /tmp/newfilename.udfs /mnt/test
>>  root at slax:/tmp# bdwrite /mnt/test 2008_pcm.m2ts     root at slax:/tmp#
>> umount /mnt/test                                   root at slax:/tmp#
>> mplayer -vo null -demuxer mpeg br://tmp/newfilename.udfs
>>
>>
>> it seems to work.
>>
>> So, I see no other way for you but compile Cingg/bdwrite with two patches
>> I provided and see if they improve situation ... (or may be Phyllis will
>> make special appimage for you)
>>
>>
>> Nice you got it to work :)
>>
>> Could you also test the same with the output.mts file I sent you and list
>> up the steps and output you get.
>> This so I can verify if I have managed to enter something wrong, or if it
>> is due to your patched bdwrite.
>>
>
> with normal (not patched) bdwrite and your file I also got
>
> bdwrite /mnt/test /dev/shm/output.mts                   interlace probe
> failed
>
>
> so, next step is compile cingg on my desktop :)
>
>
>
>
>
>>
>>
>>
>>> So I sixdoubled this with cat to the bigger 53 Mb Output.mts
>>>
>>> But sorry, got the same interlace probe error from bdwite
>>> and no content files in the BDMV structure
>>>
>>>
>>>
>>>
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20221108/61bbbed4/attachment-0001.htm>


More information about the Cin mailing list