Re: [FFmpeg-devel] [PATCH v2] dvdvideo: add DVD-Video demuxer, powered by libdvdnav and libdvdread

2024-01-10 Thread Marth64
To elaborate slightly: GENPTS is working within each segment, whose start
and end times I have from NAV packets

On Wed, Jan 10, 2024 at 10:25 Marth64  wrote:

> Thank you, Nicolas. I had tinkered with concat this way in the past as
> PGCs are indeed just a bunch of segments mushed together, but I had run
> into issues specifically with (1) concerns about forced subtitles that pop
> up mid stream and (2) unable to figure out custom IO with it. Since dvdnav
> is driving the navigation and reading of the disc, I do not have the luxury
> of knowing VOB addresses for a perfect read of the title (without fully
> playing back). So I don’t have a list of files and sectors to give concat.
> As DVD also has cell commands that drive direction of the stream, this
> complicates it further. The structure revealed by dvdread alone is not
> enough to properly play back; the dvdnav VM plays a key role. Finally, I
> had also worry about oddities when having demuxer->submuxer->subsubdemuxer.
>
> In my approach (using mpeg demux directly) there doesn’t seem to be any
> issue with concatenation/handling the gaps, and I am flushing the
> subdemuxer when they occur. Just the GENPTS sticks out as being a non-ideal
> thing to do.
>
> That said, I will take another look and see if I misunderstood at the time.
>
> Best,
>
> On Wed, Jan 10, 2024 at 04:17 Nicolas George  wrote:
>
>> Marth64 (12024-01-10):
>> > I will add that I still had to maintain a dependency on GENPTS for the
>> > inner MPEG demuxer. This is because dvdnav_get_current_time() does not
>> > provide exact stream-level PTS. However, the crashing/hanging is fixed
>> (by
>> > parsing NAV packets), and the output is produced smoothly. GENPTS fills
>> in
>> > the blanks.
>> >
>> > If anyone can think of a better way, please let me know. Right now, it
>> > works well.
>>
>> You could imitate what tools/dvd2concat does internally: use
>> libdvdread to get the structure of the DVD but let the concat demuxer
>> handle all the actual demuxing work.
>>
>> Regards,
>>
>> --
>>   Nicolas George
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] dvdvideo: add DVD-Video demuxer, powered by libdvdnav and libdvdread

2024-01-10 Thread Marth64
Thank you, Nicolas. I had tinkered with concat this way in the past as PGCs
are indeed just a bunch of segments mushed together, but I had run into
issues specifically with (1) concerns about forced subtitles that pop up
mid stream and (2) unable to figure out custom IO with it. Since dvdnav is
driving the navigation and reading of the disc, I do not have the luxury of
knowing VOB addresses for a perfect read of the title (without fully
playing back). So I don’t have a list of files and sectors to give concat.
As DVD also has cell commands that drive direction of the stream, this
complicates it further. The structure revealed by dvdread alone is not
enough to properly play back; the dvdnav VM plays a key role. Finally, I
had also worry about oddities when having demuxer->submuxer->subsubdemuxer.

In my approach (using mpeg demux directly) there doesn’t seem to be any
issue with concatenation/handling the gaps, and I am flushing the
subdemuxer when they occur. Just the GENPTS sticks out as being a non-ideal
thing to do.

That said, I will take another look and see if I misunderstood at the time.

Best,

On Wed, Jan 10, 2024 at 04:17 Nicolas George  wrote:

> Marth64 (12024-01-10):
> > I will add that I still had to maintain a dependency on GENPTS for the
> > inner MPEG demuxer. This is because dvdnav_get_current_time() does not
> > provide exact stream-level PTS. However, the crashing/hanging is fixed
> (by
> > parsing NAV packets), and the output is produced smoothly. GENPTS fills
> in
> > the blanks.
> >
> > If anyone can think of a better way, please let me know. Right now, it
> > works well.
>
> You could imitate what tools/dvd2concat does internally: use
> libdvdread to get the structure of the DVD but let the concat demuxer
> handle all the actual demuxing work.
>
> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] dvdvideo: add DVD-Video demuxer, powered by libdvdnav and libdvdread

2024-01-10 Thread Nicolas George
Marth64 (12024-01-10):
> I will add that I still had to maintain a dependency on GENPTS for the
> inner MPEG demuxer. This is because dvdnav_get_current_time() does not
> provide exact stream-level PTS. However, the crashing/hanging is fixed (by
> parsing NAV packets), and the output is produced smoothly. GENPTS fills in
> the blanks.
> 
> If anyone can think of a better way, please let me know. Right now, it
> works well.

You could imitate what tools/dvd2concat does internally: use
libdvdread to get the structure of the DVD but let the concat demuxer
handle all the actual demuxing work.

Regards,

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] dvdvideo: add DVD-Video demuxer, powered by libdvdnav and libdvdread

2024-01-10 Thread Marth64
I will add that I still had to maintain a dependency on GENPTS for the
inner MPEG demuxer. This is because dvdnav_get_current_time() does not
provide exact stream-level PTS. However, the crashing/hanging is fixed (by
parsing NAV packets), and the output is produced smoothly. GENPTS fills in
the blanks.

If anyone can think of a better way, please let me know. Right now, it
works well.

On Wed, Jan 10, 2024 at 2:47 AM Marth64  wrote:

> Dust off those old DVD discs!
>
> This version is greatly simplified and improved from the patch submitted
> in December.
> Discontinuity issues are resolved, and many discs should work smoothly out
> of the box.
> Also, GPL sector validation code is removed.
>
> Basic Usage:
> ffmpeg -f dvdvideo -title 1 -i PATH_TO_DVD_STRUCTURE ...
>
> You will have to set your own title number, although the default value (1)
> gives good coverage.
> Note that this demuxer will process one PGC only. If you are working with
> a multi-PGC title or
> strange authoring, you may specify and target an exact PGC/PG (see
> options).
>
> Known issues:
> * Chapter points are not precise, this is highest priority to fix
> * Subtitle palette support will come in the next patchset (to consolidate
> shared code)
> * Some oddly authored discs with 1 cell and a command link back to itself
> will loop infinitely,
> I am debugging this scenario.
>
> Not implemented:
> * Shuffle PGC mode, menus, or rarely used DVD features like karaoke
> extensions
> * SDDS codec is not supported, as I don't have any material to test it with
> * Seeking by time is a low priority at this time
> * Probing will come but I have some concerns to think through first
>
> Signed-off-by: Marth64 
> ---
>  Changelog |1 +
>  configure |8 +
>  libavformat/Makefile  |1 +
>  libavformat/allformats.c  |1 +
>  libavformat/avlanguage.c  |   10 +-
>  libavformat/dvdvideodec.c | 1022 +
>  6 files changed, 1041 insertions(+), 2 deletions(-)
>  create mode 100644 libavformat/dvdvideodec.c
>
> diff --git a/Changelog b/Changelog
> index 5b2899d05b..1b377fed2f 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -18,6 +18,7 @@ version :
>  - lavu/eval: introduce randomi() function in expressions
>  - VVC decoder
>  - fsync filter
> +- DVD-Video demuxer, powered by libdvdnav and libdvdread
>
>  version 6.1:
>  - libaribcaption decoder
> diff --git a/configure b/configure
> index e87a09ce83..1f21f4f1c2 100755
> --- a/configure
> +++ b/configure
> @@ -227,6 +227,8 @@ External library support:
>--enable-libdavs2enable AVS2 decoding via libdavs2 [no]
>--enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
> and libraw1394 [no]
> +  --enable-libdvdnav   enable libdvdnav, needed for DVD demuxing [no]
> +  --enable-libdvdread   enable libdvdread, needed for DVD demuxing
> [no]
>--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
>--enable-libfliteenable flite (voice synthesis) support via
> libflite [no]
>--enable-libfontconfig   enable libfontconfig, useful for drawtext
> filter [no]
> @@ -1806,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
>  frei0r
>  libcdio
>  libdavs2
> +libdvdnav
> +libdvdread
>  librubberband
>  libvidstab
>  libx264
> @@ -3519,6 +3523,8 @@ dts_demuxer_select="dca_parser"
>  dtshd_demuxer_select="dca_parser"
>  dv_demuxer_select="dvprofile"
>  dv_muxer_select="dvprofile"
> +dvdvideo_demuxer_select="mpegps_demuxer"
> +dvdvideo_demuxer_deps="libdvdnav libdvdread"
>  dxa_demuxer_select="riffdec"
>  eac3_demuxer_select="ac3_parser"
>  evc_demuxer_select="evc_frame_merge_bsf evc_parser"
> @@ -6760,6 +6766,8 @@ enabled libdav1d  && require_pkg_config
> libdav1d "dav1d >= 0.5.0" "dav1d
>  enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0"
> davs2.h davs2_decoder_open
>  enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2
> dc1394/dc1394.h dc1394_new
>  enabled libdrm&& check_pkg_config libdrm libdrm xf86drm.h
> drmGetVersion
> +enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >=
> 6.1.1" dvdnav/dvdnav.h dvdnav_open2
> +enabled libdvdread&& require_pkg_config libdvdread "dvdread >=
> 6.1.2" dvdread/dvd_reader.h DVDOpen2 -ldvdread
>  enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac
> "fdk-aac/aacenc_lib.h" aacEncOpen ||
> { require libfdk_aac fdk-aac/aacenc_lib.h
> aacEncOpen -lfdk-aac &&
>   warn "using libfdk without pkg-config";
> } }
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 581e378d95..3c1cb21fe2 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -192,6 +192,7 @@ OBJS-$(CONFIG_DTS_MUXER) += rawenc.o
>  OBJS-$(CONFIG_DV_MUXER)  += dvenc.o
>  OBJS-$(CONFIG_DVBSUB_DEMUXER)+= 

[FFmpeg-devel] [PATCH v2] dvdvideo: add DVD-Video demuxer, powered by libdvdnav and libdvdread

2024-01-10 Thread Marth64
Dust off those old DVD discs!

This version is greatly simplified and improved from the patch submitted in 
December.
Discontinuity issues are resolved, and many discs should work smoothly out of 
the box.
Also, GPL sector validation code is removed.

Basic Usage:
ffmpeg -f dvdvideo -title 1 -i PATH_TO_DVD_STRUCTURE ...

You will have to set your own title number, although the default value (1) 
gives good coverage.
Note that this demuxer will process one PGC only. If you are working with a 
multi-PGC title or
strange authoring, you may specify and target an exact PGC/PG (see options).

Known issues:
* Chapter points are not precise, this is highest priority to fix
* Subtitle palette support will come in the next patchset (to consolidate 
shared code)
* Some oddly authored discs with 1 cell and a command link back to itself will 
loop infinitely,
I am debugging this scenario.

Not implemented:
* Shuffle PGC mode, menus, or rarely used DVD features like karaoke extensions
* SDDS codec is not supported, as I don't have any material to test it with
* Seeking by time is a low priority at this time
* Probing will come but I have some concerns to think through first

Signed-off-by: Marth64 
---
 Changelog |1 +
 configure |8 +
 libavformat/Makefile  |1 +
 libavformat/allformats.c  |1 +
 libavformat/avlanguage.c  |   10 +-
 libavformat/dvdvideodec.c | 1022 +
 6 files changed, 1041 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/dvdvideodec.c

diff --git a/Changelog b/Changelog
index 5b2899d05b..1b377fed2f 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version :
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
+- DVD-Video demuxer, powered by libdvdnav and libdvdread
 
 version 6.1:
 - libaribcaption decoder
diff --git a/configure b/configure
index e87a09ce83..1f21f4f1c2 100755
--- a/configure
+++ b/configure
@@ -227,6 +227,8 @@ External library support:
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
+  --enable-libdvdnav   enable libdvdnav, needed for DVD demuxing [no]
+  --enable-libdvdread   enable libdvdread, needed for DVD demuxing [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
@@ -1806,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
 frei0r
 libcdio
 libdavs2
+libdvdnav
+libdvdread
 librubberband
 libvidstab
 libx264
@@ -3519,6 +3523,8 @@ dts_demuxer_select="dca_parser"
 dtshd_demuxer_select="dca_parser"
 dv_demuxer_select="dvprofile"
 dv_muxer_select="dvprofile"
+dvdvideo_demuxer_select="mpegps_demuxer"
+dvdvideo_demuxer_deps="libdvdnav libdvdread"
 dxa_demuxer_select="riffdec"
 eac3_demuxer_select="ac3_parser"
 evc_demuxer_select="evc_frame_merge_bsf evc_parser"
@@ -6760,6 +6766,8 @@ enabled libdav1d  && require_pkg_config libdav1d 
"dav1d >= 0.5.0" "dav1d
 enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& check_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
+enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" 
dvdnav/dvdnav.h dvdnav_open2
+enabled libdvdread&& require_pkg_config libdvdread "dvdread >= 6.1.2" 
dvdread/dvd_reader.h DVDOpen2 -ldvdread
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac &&
  warn "using libfdk without pkg-config"; } }
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 581e378d95..3c1cb21fe2 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -192,6 +192,7 @@ OBJS-$(CONFIG_DTS_MUXER) += rawenc.o
 OBJS-$(CONFIG_DV_MUXER)  += dvenc.o
 OBJS-$(CONFIG_DVBSUB_DEMUXER)+= dvbsub.o rawdec.o
 OBJS-$(CONFIG_DVBTXT_DEMUXER)+= dvbtxt.o rawdec.o
+OBJS-$(CONFIG_DVDVIDEO_DEMUXER)  += dvdvideodec.o
 OBJS-$(CONFIG_DXA_DEMUXER)   += dxa.o
 OBJS-$(CONFIG_EA_CDATA_DEMUXER)  += eacdata.o
 OBJS-$(CONFIG_EA_DEMUXER)+= electronicarts.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ce6be5f04d..ea88d4c094 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -150,6 +150,7 @@ extern const AVInputFormat  ff_dv_demuxer;
 extern const FFOutputFormat ff_dv_muxer;
 extern const AVInputFormat  ff_dvbsub_demuxer;
 extern const