Den 01.02.2024 15:58, skrev Andrew Randrianasulu:
On Thu, Feb 1, 2024 at 2:47 PM Terje J. Hanssen via Cin
<cin@lists.cinelerra-gg.org>  wrote:
I start a new thread on this topic because the previous one became long.

This time as a procedure to convert HDV video and copy MP2 audio to a DVD-Video 
compliant MPG file, by applying optional free tools

=========================================================
HDV to DVD 16x9 video using FFmpeg, DevedeNG and Xorriso
=========================================================

1) Concatenation hdv clips:
cat hdv01.m2t hdv01_01.m2t hdv01_02.m2t hdv01_03.m2t hdv01_04.m2t hdv01_05.m2t 
> HDV01-2007.m2t

du -sh HDV01-2007.m2t

12G    HDV01-2007.m2t
Guess we  should be thankful than transport stream (or even mp2 codec
- may be it was one reason why it was chosen over  mp3?)  quite
forgiving for such operation, even if ffmpeg complain a bit during
conversion ...

Yeah, I am. It is not a real issue, and I',m happy cat do the job.
The Datavideo DN300 DV/HDV recorder I use(d) to transfer from camcorder tape, uses a FAT32 file system and cut the video (stream) over IEEE1394 in 2.0 GB clips each.
https://www.globalmediapro.com/dp/A271I1/Datavideo-DN-300-HDV-Hard-Drive-Recorder/

I have also tried ffmpeg's concat protcol, which output similar messages already during concatenation
https://trac.ffmpeg.org/wiki/Concatenate

     [mpegts @ 0x55648360b900] Packet corrupt (stream = 0, dts =
   45716400).
   [in#0/mpegts @ 0x55648360b7c0] corrupt input packet in stream 0
   [mpegts @ 0x55648360b900] PES packet size mismatch

The drawback I experienced with it is that it didn't work with DV files like cat.

2) Converting HDV video and copying MP2 audio to a DVD-Video compliant MPG file 
by applying and customizing a WinFF DVD Widecreen Video profile
Suggestion to a cleaner output? Some are expected due to joining unclean clip 
cuts.
But what cause "Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options 
specified for stream 1"?
may be -f dvd -t -target pal-dvd  clash with " -c:a copy " ?

Yeah, I actually thought the same. I think I saw when I tried without specifying audio, it used ac3 by default.
I tried to encode also mp2, and the same "warning/information" appeared.


ffmpeg -hide_banner -i HDV01-2007.m2t -f dvd -target pal-dvd -aspect 16:9 -b:v 
8M -maxrate 8M -minrate 8M -bufsize 20M -muxrate 10M -mbd rd -trellis 1 -cmp 0 
-subcmp 2 -c:a copy dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg

[mpegts @ 0x562aa92c2b80] Could not find codec parameters for stream 2 
(Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' 
(5000000) options
[mpegts @ 0x562aa92c2b80] Could not find codec parameters for stream 3 
(Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' 
(5000000) options
Input #0, mpegts, from 'HDV01-2007.m2t':
   Duration: 01:02:20.32, start: 0.440000, bitrate: 26168 kb/s
   Program 100
   Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), 
yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 
fps, 25 tbr, 90k tbn
     Side data:
       cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: 
N/A
   Stream #0:1[0x814]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, 
fltp, 384 kb/s
   Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0)
   Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1)
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for 
stream 1, only the last option '-c:a copy' will be used.
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> mpeg2video (native))
   Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, dvd, to 'dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg':
   Metadata:
     encoder         : Lavf60.16.100
   Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt709, top coded first 
(swapped)), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 8000 kb/s, 25 fps, 90k tbn
     Metadata:
       encoder         : Lavc60.31.102 mpeg2video
     Side data:
       cpb: bitrate max/min/avg: 9000000/0/8000000 buffer size: 1835008 
vbv_delay: N/A
   Stream #0:1: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 448 
kb/s
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 
45716400).0.8kbits/s speed=7.25x
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 3 25
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 3870 DC, 3870 AC, 3870 MV errors in B 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpegts @ 0x562aa92c2b80] PES packet size mismatch
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 1, dts = 45699840).
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 45820800).
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 85 13
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 4950 DC, 4950 AC, 4950 MV errors in B 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 
81907200).8.7kbits/s dup=43 drop=0 speed=6.76x
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[vist#0:0/mpeg2video @ 0x562aa92f2540] timestamp discontinuity (stream 
id=2064): -9080000, new offset= 9080000
[mpeg2video @ 0x562aa9522dc0] invalid cbp -1 at 32 11
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 5130 DC, 5130 AC, 5130 MV errors in B 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpegts @ 0x562aa92c2b80] PES packet size mismatch
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 1, dts = 81890640).
[aist#0:1/mp2 @ 0x562aa95505c0] timestamp discontinuity (stream id=2068): 
-8840000, new offset= 17920000
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 
81655200).1.9kbits/s dup=264 drop=0 speed=6.78x
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 36 43
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 2250 DC, 2250 AC, 2250 MV errors in I 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 
117122400)..0kbits/s dup=287 drop=0 speed=6.78x
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[mpegts @ 0x562aa92c2b80] PES packet size mismatch
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 1, dts = 117113040).
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 66 67
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 73 DC, 73 AC, 73 MV errors in P frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 
122598000)..1kbits/s dup=307 drop=0 speed=6.82x
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 53 42
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 2336 DC, 2336 AC, 2336 MV errors in P 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 0, dts = 
209030400)..2kbits/s dup=333 drop=0 speed= 6.7x
[in#0/mpegts @ 0x562aa92c2a40] corrupt input packet in stream 0
[mpegts @ 0x562aa92c2b80] PES packet size mismatch
[mpegts @ 0x562aa92c2b80] Packet corrupt (stream = 1, dts = 209014560).
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 10 15
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 4770 DC, 4770 AC, 4770 MV errors in P 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[mpeg2video @ 0x562aa9522dc0] ac-tex damaged at 35 1035.48 
bitrate=8121.7kbits/s dup=353 drop=0 speed=6.74x
[mpeg2video @ 0x562aa9522dc0] Warning MVs not available
[mpeg2video @ 0x562aa9522dc0] concealing 5220 DC, 5220 AC, 5220 MV errors in P 
frame
[vist#0:0/mpeg2video @ 0x562aa92f2540] corrupt decoded frame
[out#0/dvd @ 0x562aa935bac0] video:3486651kB audio:175455kB subtitle:0kB other 
streams:0kB global headers:0kB muxing overhead: 1.736119%
frame=93956 fps=168 q=2.0 Lsize= 3725684kB time=01:02:38.16 
bitrate=8121.2kbits/s dup=355 drop=0 speed=6.74x

---------------------

du -sh dvd*.mpg

3,6G    dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg


ffprobe -hide_banner dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg

[mpeg @ 0x563adeaee080] start time for stream 0 is not set in 
estimate_timings_from_pts
Input #0, mpeg, from 'dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg':
   Duration: 01:02:38.24, start: 0.540000, bitrate: 8121 kb/s
   Stream #0:0[0x1bf]: Data: dvd_nav_packet
   Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt709, 
progressive), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn
     Side data:
       cpb: bitrate max/min/avg: 9000000/0/0 buffer size: 1835008 vbv_delay: N/A
   Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
Unsupported codec with id 98312 for input stream 0

isn't it strange that ffprobe now says

   Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s

while earlier it was

Stream #0:1: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
fltp, 448 kb/s

Yeah, I didn't discover that and have no idea why. However when I encoded mp2 first with bit rate 384 kb/s. this was used correct in both cases. And 384 kb/s is correct both for the hdv input and mpg output

   mediainfo dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg  | egrep "Bit
   rate|bit rate"
   Overall bit rate mode                    : Variable
   Overall bit rate                         : 8 121 kb/s
   Bit rate mode                            : Variable
   Bit rate                                 : 7 575 kb/s
   Maximum bit rate                         : 9 000 kb/s
   Bit rate mode                            : Constant
   Bit rate                                 : 384 kb/s


----------------------------

3) Creating DVD-Video with DevedeNG

Add: dvd_16x9_copy_mp2_ffmpeg_HDV01-2007.mpg and highlight it
Properities >
Misch: check This file is already a DVD suitable MPEG-PS file
              keep Use a GOP of 12 frames (compatibility)
Use
Directory location and DVD directory name
Further; Creating DVD structure and iso



   tree -sh DVD_16x9_copy_mp2_ffmpeg_HDV01-2007

DVD_16x9_copy_mp2_ffmpeg_HDV01-2007
├── [3.6G]  DVD_16x9_copy_mp2_ffmpeg_HDV01-2007.iso
├── [4.0K]  dvd_tree
│   ├── [4.0K]  AUDIO_TS
│   └── [4.0K]  VIDEO_TS
│       ├── [ 12K]  VIDEO_TS.BUP
│       ├── [ 12K]  VIDEO_TS.IFO
│       ├── [ 32K]  VIDEO_TS.VOB
│       ├── [ 18K]  VTS_01_0.BUP
│       ├── [ 18K]  VTS_01_0.IFO
│       ├── [3.9M]  VTS_01_0.VOB
│       ├── [ 32K]  VTS_01_1.VOB
│       ├── [ 48K]  VTS_02_0.BUP
│       ├── [ 48K]  VTS_02_0.IFO
│       ├── [ 32K]  VTS_02_0.VOB
│       ├── [1024M]  VTS_02_1.VOB
│       ├── [1024M]  VTS_02_2.VOB
│       ├── [1024M]  VTS_02_3.VOB
│       └── [566M]  VTS_02_4.VOB
├── [4.0K]  menu
│   ├── [2.9K]  menu_0_active_bg.png
│   ├── [ 62K]  menu_0_bg.png
│   ├── [3.9M]  menu_0B.mpg
│   ├── [3.9M]  menu_0.mpg
│   ├── [2.9K]  menu_0_selected_bg.png
│   ├── [1.7K]  menu_0_unselected_bg.png
│   └── [ 484]  menu_0.xml
├── [4.0K]  movies
│   └── [3.6G]  movie_0.mpg
└── [4.0K]  xml_data
     └── [1.9K]  dvdauthor.xml
I guess here only dvd_tree  will be put on iso ? Note that files
chopped into  no bigger than 1Gb chucks.
Yes, but the [3.6G] movie_0.mpg is super handy for pre-testing playback of video+audio with i.e VLC and ffplay tree -sh /run/media/terje/DVDVIDEO

   /run/media/terje/DVDVIDEO ├── [ 40] AUDIO_TS └── [ 768] VIDEO_TS ├──
   [ 12K] VIDEO_TS.BUP ├── [ 12K] VIDEO_TS.IFO ├── [ 32K] VIDEO_TS.VOB
   ├── [ 18K] VTS_01_0.BUP ├── [ 18K] VTS_01_0.IFO ├── [3.9M]
   VTS_01_0.VOB ├── [ 32K] VTS_01_1.VOB ├── [ 48K] VTS_02_0.BUP ├── [
   48K] VTS_02_0.IFO ├── [ 32K] VTS_02_0.VOB ├── [1024M] VTS_02_1.VOB
   ├── [1024M] VTS_02_2.VOB ├── [1024M] VTS_02_3.VOB └── [566M]
   VTS_02_4.VOB 2 directories, 14 files

--------------------------------

Testing playback OK

ffplay -hide_banner 
/home/terje/Videoklipp/M2T-MOV/DVD_16x9_copy_mp2_ffmpeg_HDV01-2007/movies/movie_0.mpg

[mpeg @ 0x7fbfd8000cc0] start time for stream 0 is not set in 
estimate_timings_from_pts
Input #0, mpeg, from 
'/home/terje/Videoklipp/M2T-MOV/DVD_16x9_copy_mp2_ffmpeg_HDV01-2007/movies/movie_0.mpg':
   Duration: 01:02:38.24, start: 0.540000, bitrate: 8121 kb/s
   Stream #0:0[0x1bf]: Data: dvd_nav_packet
   Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt709, 
progressive), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn
     Side data:
       cpb: bitrate max/min/avg: 9000000/0/0 buffer size: 1835008 vbv_delay: N/A
   Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
   20.67 A-V: -0.006 fd=   0 aq=   47KB vq= 1209KB sq=    0B f=0/0


---------------

cd /home/terje/Videoklipp/M2T-MOV/DVD_16x9_copy_mp2_ffmpeg_HDV01-2007
ls
DVD_16x9_copy_mp2_ffmpeg_HDV01-2007.iso DVD_16x9_copy_mp2_ffmpeg_HDV01-2007.iso 
dvd_tree  menu  movies  xml_data

4) Burning the iso to a DVD+RW disk

xorriso -as cdrecord -v -sao dev=/dev/sr1  
DVD_16x9_copy_mp2_ffmpeg_HDV01-2007.iso

xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev '/dev/sr1'
Media current: DVD+RW
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 4483m free
Beginning to write data track.
xorriso : UPDATE : Formatting. Working since 0 seconds
xorriso : UPDATE : Formatting. Working since 1 seconds
xorriso : UPDATE : Formatting. Working since 2 seconds
xorriso : UPDATE : Formatting. Working since 3 seconds
xorriso : UPDATE : Formatting. Working since 4 seconds
libburn : NOTE : Write start address is  0 * 2048
xorriso : UPDATE :    0 of 3643 MB written (fifo 99%) [buf   0%]   0.0x.
xorriso : UPDATE :    0 of 3643 MB written (fifo 99%) [buf   0%]   0.0x.
xorriso : UPDATE :    0 of 3643 MB written (fifo 99%) [buf   0%]   0.4x.
xorriso : UPDATE :    0 of 3643 MB written (fifo 99%) [buf   0%]   0.0x.
xorriso : UPDATE :    6 of 3643 MB written (fifo 97%) [buf  99%]   4.1x.
..........
xorriso : UPDATE : 3621 of 3643 MB written (fifo 97%) [buf  99%]   4.0x.
xorriso : UPDATE : 3626 of 3643 MB written (fifo 97%) [buf  99%]   4.0x.
xorriso : UPDATE : 3631 of 3643 MB written (fifo 98%) [buf  99%]   4.0x.
xorriso : UPDATE : 3637 of 3643 MB written (fifo 99%) [buf  99%]   4.0x.
xorriso : UPDATE : 3642 of 3643 MB written (fifo 19%) [buf  99%]   4.0x.
xorriso : UPDATE : Closing track/session. Working since 709 seconds
xorriso : UPDATE : Closing track/session. Working since 710 seconds
xorriso : UPDATE : Closing track/session. Working since 711 seconds
xorriso : UPDATE : Closing track/session. Working since 712 seconds
Writing to '/dev/sr1' completed successfully.

xorriso : NOTE : Re-assessing -outdev '/dev/sr1'
Drive current: -outdev '/dev/sr1'
Media current: DVD+RW
Media status : is written , is appendable
Media summary: 1 session, 1865398 data blocks, 3643m data,  839m free

------------------

Tested the DVD-Video disk playback ok in a DVD standalone player and ditto BD 
player.

Visual impression:
HDV down-conversion (oversampling) to 16x9 DVD-Video results in noticeable 
better quality than former DV source.
well, we bet 2x more pixels on each dimension  SHOULD make some
difference :) But nice to have  visual conformation
that even with donconverting / downscaling to same size bigger source
actually provides some benefits ...

The author of my second HDV book (2007)
https://www.amazon.com/Working-HDV-Shoot-Deliver-Definition/dp/0240808886
also says page 39:

   /When you acquire footage  in HD, you record more picture
   information than when you record in SD. As a result when you
   downconvert HD footage to SD, you starting with more picture
   information, so your image will look better than if you recordered
   in SD in the first place. This process is called oversampliing and
   it's another benefit to investing in HDV, even if you still
   primarily deliver SD projects./

A few others comments I've seen thought this could cause various problems ....


--
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to