[Cin] DVD compliant MPEG-2 Video and PCM Audio

Terje J. Hanssen terjejhanssen at gmail.com
Wed Mar 8 14:14:56 CET 2023



Den 06.03.2023 21:30, skrev Andrew Randrianasulu:
>
>
> пн, 6 мар. 2023 г., 23:00 Andrew Randrianasulu <randrianasulu at gmail.com>:
>
>
>
>     пн, 6 мар. 2023 г., 22:51 Terje J. Hanssen <terjejhanssen at gmail.com>:
>
>
>
>         Den 06.03.2023 15:02, skrev Andrew Randrianasulu:
>>         I think you need another software like (q)dvdauthor or
>>         dvdstyler to make DVD - they use *program* streams, not
>>         transport streams as tsMuxer creates ...
>
>         I thought first to use mkisofs, but didnt really find out the
>         relevant syntax to make a video dvd iso from the ffmpeg
>         created dv28.mpg file with pcm audio.
>
>         Had a quick look in DVD styler, but for audio it seemed to
>         support only AC3 or MP2 audio.
>
>
>
>     I think because project still active you can look at their support
>     place and see if anyone made request for this already, or if not -
>     log your own.
>
>     https://sourceforge.net/p/dvdstyler/discussion/318795/thread/00ecc86f13/
>
>
>     =====
>     If you use Mplex for muxing then Mplex will abort with a message
>     that it cannot recognize the audio stream. This is an Mplex issue.
>     It is no problem for Mplex to mux an LPCM audio stream, but the
>     file must have the extension "lpcm". You can verify this by
>     renaming the audio file in the DVDStyler cache folder and give it
>     the "lpcm" extension. Then feed the video and this renamed audio
>     stream to Mplex for muxing, and you will get a perfect MPEG2 file
>     with PCM audio.
>
>     ====
>
>
>
> Also from mjpegtools mail list archive:
>
> https://www.mail-archive.com/mjpeg-users@lists.sourceforge.net/msg06753.html
>
> https://www.mail-archive.com/mjpeg-users@lists.sourceforge.net/msg06759.html
>
> apparently you must use one big mpeg file in this case
>
> =====
>
>
> bn 
> <https://www.mail-archive.com/search?l=mjpeg-users@lists.sourceforge.net&q=from:%22bn%22> 
> Fri, 05 May 2006 20:02:05 -0700 
> <https://www.mail-archive.com/search?l=mjpeg-users@lists.sourceforge.net&q=date:20060505> 
>
>
> Well folks(?),
>
> No responses but I appear to have made some headway, which I'll share 
> here in case someone's out there somewhere scratching their own head 
> over this.
>
> The problem seems to have to do with dvdauthor's STC discontinuity at 
> the chapter points when it's fed one file per chapter; the initial 
> pts/dts values are reset, and this somehow throws things off during 
> playback, even if audio and video endpoints are perfectly aligned.
>
> If the whole titleset is mplexed as one mpg and then dvdauthored with 
> chapter- point offsets, the gaps disappear.  Also, if the chapter 
> points aren't aligned to GOP boundaries, dvdauthor will do it anyway 
> and shift them backwards.
>
> Bahman
>
> =====
>
> I hope this workflow is not bitrotted. According to man page from 
> https://linux.die.net/man/1/mplex mplex accept lpcm params:
>
>
> ===
>
> *L|--lpcm-params*
>     /samples_per_sec:channels:bits_per_sample/
>     [, /samples_per_sec:channels:bits_per_sample/ ...]
>
>     A comma-seperated list of paramter sets for the lpcm audio streams
>     (given in the order the lpcm streams appear on the command line).
>     Each parameter set comprises the sampling rate in Hz, the number
>     of channels, and the number of bits per sample seperated by
>     colons. For example, the default 48kHz two-channel 16-bit audio
>     would be specified as 48000:2:16.
>
> Note: these parameters are necessary because mplex expects raw LPCM
>     audio data without any headers. That is: for each sample point a
>     group of 16,20, or 24 bit amplitude values, one for each channel.
>     Amplitude values are signed with the constituent bytes in
>     big-endian (most significant bytes first) order. For 20 bit
>     samples I am not sure but what documentation I have suggests such
>     samples are padded at the lsb end so that they byte-align at the
>     most significant bits. 
>
>
> ====
>
>
> https://www.mail-archive.com/search?l=mjpeg-users%40lists.sourceforge.net&q=lpcm 
> <https://www.mail-archive.com/search?l=mjpeg-users%40lists.sourceforge.net&q=lpcm>
>
> some more reading from 2005-6 era.


Not a direct respons, but I think I have come a step forward via a five 
years old ffmpeg bug report:

    https://trac.ffmpeg.org/ticket/6782
    Doesn't produce MPEGPS-MPEG-2-LPCM compliant output (-target, -f
    dvd, -f vob). Buffer underflow appear.
    pcm_dvd added; mpegps -target removed

There is obviously a deticated "pcm_dvd" codec for ffmpeg, 
correspondingly to the later "pcm_bluray".
So I verified this on my ffmpeg 5.1.2 built from Packman for Tumbleweed 
and found:

    ffmpeg -hide_banner -codecs | egrep "pcm_bluray|pcm_dvd"
      DEAI.S pcm_bluray           PCM signed 16|20|24-bit big-endian for
    Blu-ray media
      DEAI.S pcm_dvd              PCM signed 20|24-bit big-endian


Transcoded input raw DV with PCM audio to MPEG-2 video pcm_dvd audio in 
a VOB/MPG format:

    ffmpeg -hide_banner -i dv01.dv -c:v mpeg2video -refs 1 -bf 2 -b:v 8M
    -maxrate 8M -minrate 8M -bufsize 20M -muxrate 11M -dc 10 -c:a
    *pcm_dvd* -f vob -flags +ilme+ildct dv01.mpg
         ............ still a lot of
         [vob @ 0x562a8c68f240] buffer underflow st=1 bufi=1392 size=2008
             Last message repeated 6 times
         [vob @ 0x562a8c68f240] buffer underflow st=1 bufi=1396 size=2008
         frame=14912 fps=298 q=3.9 Lsize=  703652kB time=00:09:56.48
    bitrate=9663.9kbits/s speed=11.9x
         video:582644kB audio:112007kB subtitle:0kB other streams:0kB
    global headers:0kB muxing overhead: 1.295818%


    du -sh *.dv *.mpg
         2,0G    dv01.dv
         688M    dv01.mpg


Verified that the ffmpeg *dv01.mpg* output file contains *pcm_dvd*

     ffprobe -hide_banner dv01.mpg

         Input #0, mpeg, from 'dv01.mpg':
           Duration: 00:09:56.48, start: 0.540000, bitrate: 9663 kb/s
           Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv,
    bottom first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn
             Side data:
               cpb: bitrate max/min/avg: 8000000/0/0 buffer size:
    20004864 vbv_delay: N/A
           Stream #0:1[0xa0]: Audio: *pcm_dvd*, 48000 Hz, stereo, s16,
    1536 kb/s


The DVD structure and video files from DeVeDe is now being transcoded 
from pcm_dvd to AC-3 audio:

    tree ./dv01_tw_DVD -sh

         [4.0K]  ./dv01_tw_DVD
         ├── [500M]  dv01_tw_DVD.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.1M]  VTS_01_0.VOB
         │       ├── [ 32K]  VTS_01_1.VOB
         │       ├── [ 24K]  VTS_02_0.BUP
         │       ├── [ 24K]  VTS_02_0.IFO
         │       ├── [ 32K]  VTS_02_0.VOB
         │       └── [496M]  VTS_02_1.VOB
         ├── [4.0K]  menu
         │   ├── [1.9K]  menu_0_active_bg.png
         │   ├── [ 61K]  menu_0_bg.png
         │   ├── [3.1M]  menu_0B.mpg
         │   ├── [3.1M]  menu_0.mpg
         │   ├── [1.9K]  menu_0_selected_bg.png
         │   ├── [1.7K]  menu_0_unselected_bg.png
         │   └── [ 451]  menu_0.xml
         ├── [4.0K]  movies
         │   └── [496M]  movie_0.mpg
         └── [4.0K]  xml_data
             └── [1.7K]  dvdauthor.xml

         7 directories, 21 files



    ffprobe -hide_banner dv01_tw_DVD/dvd_tree/VIDEO_TS/VTS_02_1.VOB

         Input #0, mpeg, from 'dv01_tw_DVD/dvd_tree/VIDEO_TS/VTS_02_1.VOB':
           Duration: 00:09:56.49, start: 0.534667, bitrate: 6970 kb/s
           Stream #0:0[0x1bf]: Data: dvd_nav_packet
           Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv,
    progressive), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn
             Side data:
               cpb: bitrate max/min/avg: 7500000/0/0 buffer size:
    1835008 vbv_delay: N/A
           Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s



    ffprobe -hide_banner dv01_tw_DVD/movies/movie_0.mpg

         [mpeg @ 0x555ff4407ec0] start time for stream 0 is not set in
    estimate_timings_from_pts
         Input #0, mpeg, from 'movie_0.mpg':
           Duration: 00:09:56.49, start: 0.534667, bitrate: 6970 kb/s
           Stream #0:0[0x1bf]: Data: dvd_nav_packet
           Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv,
    progressive), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn
             Side data:
               cpb: bitrate max/min/avg: 7500000/0/0 buffer size:
    1835008 vbv_delay: N/A
           Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
         Unsupported codec with id 98312 for input stream 0


I looks like DeVeDeNG version 4.17 possibly doesn't support pcm_dvd yet. 
To get this clarified I have written to the author to try to get this 
clarified.
My first impression of this program is that I got taste for its 
simplicity and straight forward use, yet relative comprehensive behind 
the buttons.

    https://gitlab.com/rastersoft/devedeng
    https://www.rastersoft.com/programas/devede.html
    https://www.xmodulo.com/create-video-dvd-linux-desktop.html

    Documentation for the legacy DeVeDe 3.9 version
    https://www.rafalinux.com/?page_id=248



>
>
>
>
>         DeVeDe:
>         So I installed and tried "DeVeDe(NG)" - a "Video DVD creator"
>         program I had never heard about before recently
>         https://www.xmodulo.com/create-video-dvd-linux-desktop.html
>
>         With DeVeDe I managed to create the video DVD structure and
>         ISO, and it offered to burn the iso with K3b automatically,
>         With its Property/Misch buttons the selection in the middle
>         offered:
>         *Repack audio and video without reencoding (Useful for VOB files)
>
>         The problem is that the Audio (PCM) disappeared from the
>         dv28.mpg input file
>
>         The burned DVD from iso:
>
>             tree ./DVDVIDEO -sh
>
>             ./DVDVIDEO
>             ├── [  40]  AUDIO_TS
>             └── [ 612]  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.6M]  VTS_01_0.VOB
>                 ├── [ 32K]  VTS_01_1.VOB
>                 ├── [ 18K]  VTS_02_0.BUP
>                 ├── [ 18K]  VTS_02_0.IFO
>                 ├── [ 32K]  VTS_02_0.VOB
>                 └── [133M]  VTS_02_1.VOB
>
>             2 directories, 11 files
>
>
>         The structure and iso created on HDD:
>
>             tree . -sh
>
>             .
>             ├── [138M]  dv28_DVD.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.6M]  VTS_01_0.VOB
>             │       ├── [ 32K]  VTS_01_1.VOB
>             │       ├── [ 18K]  VTS_02_0.BUP
>             │       ├── [ 18K]  VTS_02_0.IFO
>             │       ├── [ 32K]  VTS_02_0.VOB
>             │       └── [133M]  VTS_02_1.VOB
>             ├── [4.0K]  menu
>             │   ├── [2.0K]  menu_0_active_bg.png
>             │   ├── [ 64K]  menu_0_bg.png
>             │   ├── [3.6M]  menu_0B.mpg
>             │   ├── [3.6M]  menu_0.mpg
>             │   ├── [2.0K]  menu_0_selected_bg.png
>             │   ├── [1.7K]  menu_0_unselected_bg.png
>             │   └── [ 442]  menu_0.xml
>             ├── [4.0K]  movies
>             │   └── [133M]  movie_0.mpg
>             └── [4.0K]  xml_data
>                 └── [1.7K]  dvdauthor.xml
>
>             6 directories, 21 files
>
>
>
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20230308/69a5bc43/attachment-0001.htm>


More information about the Cin mailing list