On Thursday, December 2, 2021, Terje J. Hanssen <terjejhanssen@gmail.com> wrote:


Den 01.12.2021 18:30, skrev Andrew Randrianasulu:


On Tuesday, November 30, 2021, Terje J. Hanssen <terjejhanssen@gmail.com <mailto:terjejhanssen@gmail.com>> wrote:

    Tested the original sample script with minimal changes. A lot of
    buffer underflow messages, but the PCM audio stream was muxed and
    worked in VLC:

    ffmpeg -i dv28.dv -c:v mpeg2video -pix_fmt yuv422p -refs 1 -bf 2
    -b:v 25M -maxrate 25M -minrate 25M -s 720x576 -aspect 4:3 -c:a
    pcm_s16be -f vob dv28.mpg

    [vob @ 0x562322bbb6c0] packet too large, ignoring buffer limits to
    mux it
    [vob @ 0x562322bbb6c0] buffer underflow st=1 bufi=6876 size=7680
    frame= 3416 fps=374 q=2.2 Lsize=  448010kB time=00:02:16.60
    bitrate=26867.5kbits/s speed=  15x
    video:416900kB audio:25620kB subtitle:0kB other streams:0kB global
    headers:0kB muxing overhead: 1.240520%


    ffmpeg -i dv28.mpg  2>&1 >/dev/null | egrep "Video|Audio"
      Stream #0:0[0x1e0]: Video: mpeg2video (4:2:2), yuv422p(tv,
    progressive), 720x576 [SAR 16:15 DAR 4:3], 25000 kb/s, 25 fps, 25
    tbr, 90k tbn, 50 tbc
      Stream #0:1[0xa0]: Audio: pcm_dvd, 48000 Hz, stereo, s16, 1536 kb/s


    mediainfo dv28.mpg | grep Format
    Format            : MPEG-PS
    Format            : MPEG Video
    Format version     : Version 2
    Format profile     : 4:2:2@Main
    Format settings     : BVOP
    Format settings, BVOP                    : Yes
    Format settings, Matrix                  : Default
    Format settings, GOP                     : M=3, N=12
    Format            : PCM
    Format settings     : Big / Signed


there is also -muxrate and -bufsize options..
https://stackoverflow.com/questions/44392689/ffmpeg-vbr-cbr-conversion-and-streaming-of-mpeg-2-ts-video-files <https://stackoverflow.com/questions/44392689/ffmpeg-vbr-cbr-conversion-and-streaming-of-mpeg-2-ts-video-files>

try bufsize = muxrate = much bigger (1.8x?) than min/maxrate...

ffmpeg exposes a lot of knobs...

you also can try '-dc 9' 10 or 11 for higher-precision in some mpeg2 math..

===========

ffmpeg -i dv28.dv -c:v mpeg2video -pix_fmt yuv422p -refs 1 -bf 2 -b:v 25M -maxrate 25M -minrate 25M -bufsize 45M -muxrate 45M -dc 10 -s 720x576 -aspect 4:3 -c:a pcm_s16be -f vob dv28.mpg

Still a lot of ouput messages (some hundreds), tested -bufsize 45M -muxrate 45M (and 50M without change):
[vob @ 0x557560237700] packet too large, ignoring buffer limits to mux it
[vob @ 0x557560237700] buffer underflow st=1 bufi=6892 size=7680
........... and lastly
frame= 3416 fps=359 q=1.6 Lsize=  446718kB time=00:02:16.60 bitrate=26790.0kbits/s speed=14.4x
video:415625kB audio:25620kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.240393%

-----------

The format setting "-f vob" in the original script, was maybe the trick that got ffmpeg to "mux" PCM audio into the mpg container, and not to other I tried(?)

VOB is usual the DVD-video container where video has max bitrate 9.8 Mbps.
I could find again if Blu-ray specification allows "VOB-video" or MPG-video here with high bitrate 25M?

=============

tsMuxer
As FFMpeg would allow to mux PCM or remux MPG to M2TS, I tested tsMuxer, see the attached screenshot: tsMuxer_SD_M2TS
Input file:  dv28.mpg
Tracs:       MPEG-2 video stream and LPCM audio stream
Output:      M2TS muxing worked, Blu-ray ISO and Blu-ray Folder (tested as working fast and easy)


ffmpeg -i dv28.m2ts  2>&1 >/dev/null | egrep "Video|Audio"
  Stream #0:0[0x1011]: Video: mpeg2video (4:2:2) (HDMV / 0x564D4448), yuv422p(tv, progressive), 720x576 [SAR 16:15 DAR 4:3], 25000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
  Stream #0:1[0x1100]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, s16, 1536 kb/s

ffmpeg -i dv28_Blu-ray.iso  2>&1 >/dev/null | egrep "Video|Audio"
  Stream #0:0[0x1011]: Video: mpeg2video (4:2:2) (HDMV / 0x564D4448), yuv422p(tv, progressive), 720x576 [SAR 16:15 DAR 4:3], 25000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
  Stream #0:1[0x1100]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, s16, 1536 kb/s


mediainfo dv28.m2ts | grep Format
Format                                   : BDAV
Format/Info                              : Blu-ray Video
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : 4:2:2@Main
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, GOP                     : M=3, N=12
Format                                   : PCM
Format settings                          : Big / Signed


mediainfo dv28_Blu-ray.iso | grep Format
Format                                   : MPEG Video
Format version                           : Version 2
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : 4:2:2@Main
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, GOP                     : M=3, N=12


 tree -h BDMV
BDMV
├── [4.0K]  AUXDATA
├── [4.0K]  BACKUP
│   ├── [4.0K]  BDJO
│   ├── [4.0K]  CLIPINF
│   │   └── [1.8K]  00000.clpi
│   ├── [ 120]  index.bdmv
│   ├── [ 290]  MovieObject.bdmv
│   └── [4.0K]  PLAYLIST
│       └── [ 170]  00000.mpls
├── [4.0K]  BDJO
├── [4.0K]  CLIPINF
│   └── [1.8K]  00000.clpi
├── [ 120]  index.bdmv
├── [4.0K]  JAR
├── [4.0K]  META
├── [ 290]  MovieObject.bdmv
├── [4.0K]  PLAYLIST
│   └── [ 170]  00000.mpls
└── [4.0K]  STREAM
    └── [456M]  00000.m2ts

11 directories, 9 files

===========

for minimising disk loss you probably can prep. few samples with different encoding/muxing params and burn them all on one disk and see how well/bad your hw player plays (and seeks) them..

Good idea.
I tried to burn dv28_Blu-ray.iso to a DVD-R disc with the gui burners Brasero and K3b, but both quitted at start with Failure.

did they show detailed error message? 



Suggestion to how customize the previous "CL for HDV to Blu-ray" to burn the now ready made dv28_Blu-ray.iso (with udf included?)
and also the BDMV and CERTIFICATE folders to DVD-R/DVD+R and DVD+RW discs?

try growisofs line from manual with this file? 

also what "file' and udfinfo/bdinfo says about this iso? 

For trying to burn just as data disk - try to drag those folders into k3d and do not forgot to check udf option somewhere (it probably will create hybrid iso/udf 1 fs - not sure if such disk will be seen as avchd by playe.. but worth trying at least once) 

========

Terje J. H