Re: [NTG-context] multimedia PDF in ConTeXt

2021-07-31 Thread Pablo Rodriguez via ntg-context
On 7/31/21 1:08 AM, Michal Vlasák via ntg-context wrote:
> [...]
> By the way, Pablo, your issue
> https://www.mail-archive.com/ntg-context@ntg.nl/msg88204.html was also
> solved in the last upload. Unfortunately it will probably not help you,
> because Acrobat no longer supports this.
> [...]
> But, you can use renderings instead:
>
> \useexternalrendering[myaudiorendering]
>   [audio/mp3][audio.mp3][embed=yes]
>
> \definerenderingwindow[audiowindow]
>   [width=0sp, height=0sp]
>
> \definelayer[resources]
> \setupbackgrounds[page][background=resources]
> \setlayer[resources]{\placerenderingwindow[audiowindow][myaudiorendering]}
>
> \goto{PLAY SOUND}[StartRendering{myaudiorendering}]
>
> This is basically the example from "/back-swf.mkiv". Works in Acrobat.
> And one can use either of the three possible file methods (embedded,
> external, URL), not just external files. The layer is so that the empty
> frame doesn't interfere with normal page content. No frame is drawn when
> both dimensions are 0, not sure if that is a behaviour one can take as
> granted. But currenntly the dimensions can't be zero.

Many thanks for your code update, Michal.

I’m extremely interested in investigating the possibilities this opens.

But I’m afraid that I will have other things to do first. It will take
me months to come back to this again.

> Hans, I would omit the check for 0 dimensions of rendering window (as
> already noted in the source, it is useful for sound). See patch below.

Many thanks for the patch and for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] multimedia PDF in ConTeXt

2021-07-31 Thread Pablo Rodriguez via ntg-context
On 7/30/21 11:57 PM, Michal Vlasák via ntg-context wrote:
> On Fri Jul 30, 2021 at 8:53 PM CEST, Pablo Rodriguez via ntg-context wrote:
>> [...]
>> Although I don’t read Czech, just out of curiosity, is your bachelor
>> thesis available on the net, Michal? Thanks to theses.cz, I found
>> https://is.muni.cz/th/t8qpp/DP_Vlasak_Michal_2015.pdf (only a name
>> coincidence, I guess).
>
> Sorry, should have shared the link at the first place.
>
> https://dspace.cvut.cz/handle/10467/95065

Many thanks for your fast reply and the link to your thesis, Michal.

>> [...]
>> Is there no way to have the video as an embedded file in the PDF
>> document? (I mean, that the file is listed when the attachment panel is
>> displayed.)
>
> Currently, only attachments are added as "embedded files" (either as
> "hidden", ending up in /EmbeddedFiles, or as "annotation" ending up as
> /FileAttachment annotation).
>
> Maybe "codeinjections.embedfile" can have the option to force the
> reference, so that the file also ends up in /EmbeddedFiles? Should it be
> default for all \externalrenderings?
> [...]
> --- a/tex/context/base/mkxl/lpdf-wid.lmt
> +++ b/tex/context/base/mkxl/lpdf-wid.lmt
> [...]

Many thanks for the patch.

It would be also great to have an option not to list some files as
embedded (adding a option "list" to "\useexternalrendering" such as in
"\useexternalrendering[myvideo][video/mp4][video.mp4][embed=yes, list=no]").

Being the default to yes, I’m thinking of cases where there is a risk
distributing the multimedia file without the embedding document, because
of the lack of context (no pun indented)

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] multimedia PDF in ConTeXt

2021-07-30 Thread Michal Vlasák via ntg-context
On Fri Jul 30, 2021 at 8:53 PM CEST, Pablo Rodriguez via ntg-context wrote:
> Hi Michal and Hans,
>
> many thanks for your patch to fix multimedia objects in PDF and your
> extremely interesting and in-depth explanation about multimedia in PDF.
> Many thanks to Hans for the release of an updated latest with also
> updated documentation.

By the way, Pablo, your issue
https://www.mail-archive.com/ntg-context@ntg.nl/msg88204.html was also
solved in the last upload. Unfortunately it will probably not help you,
because Acrobat no longer supports this.

\useexternalsoundtrack
  [myaudio][audio.mp3]

\checksoundtrack{myaudio}

\goto{PLAY SOUND}[StartSound{myaudio}]


But, you can use renderings instead:

\useexternalrendering[myaudiorendering]
  [audio/mp3][audio.mp3][embed=yes]

\definerenderingwindow[audiowindow]
  [width=0sp, height=0sp]

\definelayer[resources]
\setupbackgrounds[page][background=resources]
\setlayer[resources]{\placerenderingwindow[audiowindow][myaudiorendering]}

\goto{PLAY SOUND}[StartRendering{myaudiorendering}]


This is basically the example from "/back-swf.mkiv". Works in Acrobat.
And one can use either of the three possible file methods (embedded,
external, URL), not just external files. The layer is so that the empty
frame doesn't interfere with normal page content. No frame is drawn when
both dimensions are 0, not sure if that is a behaviour one can take as
granted. But currenntly the dimensions can't be zero.

Hans, I would omit the check for 0 dimensions of rendering window (as
already noted in the source, it is useful for sound). See patch below.

Michal Vlasák

--- a/tex/context/base/mkxl/lpdf-wid.lmt
+++ b/tex/context/base/mkxl/lpdf-wid.lmt
@@ -655,9 +655,6 @@ local function insertrenderingwindow(specification)
 }
 local width = specification.width or 0
 local height = specification.height or 0
-if height == 0 or width == 0 then
--- todo: sound needs no window
-end
 context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref
 return pdfreference(r)
 end
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] multimedia PDF in ConTeXt

2021-07-30 Thread Michal Vlasák via ntg-context
On Fri Jul 30, 2021 at 8:53 PM CEST, Pablo Rodriguez via ntg-context wrote:
> Hi Michal and Hans,
>
> many thanks for your patch to fix multimedia objects in PDF and your
> extremely interesting and in-depth explanation about multimedia in PDF.
> Many thanks to Hans for the release of an updated latest with also
> updated documentation.
>
> Although I don’t read Czech, just out of curiosity, is your bachelor
> thesis available on the net, Michal? Thanks to theses.cz, I found
> https://is.muni.cz/th/t8qpp/DP_Vlasak_Michal_2015.pdf (only a name
> coincidence, I guess).

Sorry, should have shared the link at the first place.

https://dspace.cvut.cz/handle/10467/95065

(PLNY_TEXT) links to the full text.

(PRILOHA) is almost all files I had for the thesis. Most notably the
testing files I used. (Some were handcoded, so no sources, but these
should be readable in text editors).

> Using your sample, I have two questions:
>
> \starttext
> \setupinteraction[state=start]
>
> \useexternalrendering[myvideo][video/mp4][video.mp4][embed=yes]
>
> \definerenderingwindow[myrenderingwindow]
> [width=\textwidth, height=\textwidth]
>
> \placerenderingwindow[myrenderingwindow][myvideo]
> \stoptext
>
> Is there no way to have the video as an embedded file in the PDF
> document? (I mean, that the file is listed when the attachment panel is
> displayed.)

Currently, only attachments are added as "embedded files" (either as
"hidden", ending up in /EmbeddedFiles, or as "annotation" ending up as
/FileAttachment annotation).

Maybe "codeinjections.embedfile" can have the option to force the
reference, so that the file also ends up in /EmbeddedFiles? Should it be
default for all \externalrenderings?

My try:

https://github.com/contextgarden/context-mirror/commit/681c36d0ecfd30c05ed588eb0f37a06dd19f3492

(the full file can be located by clicking on the three dots after the
file name, then "View file" and then "Raw", resulting in:

https://github.com/contextgarden/context-mirror/blob/681c36d0ecfd30c05ed588eb0f37a06dd19f3492/tex/context/base/mkxl/lpdf-wid.lmt,

Patch can be obtained by adding .diff to the URL:

https://github.com/contextgarden/context-mirror/commit/681c36d0ecfd30c05ed588eb0f37a06dd19f3492.diff

I will probably not keep the commit on GitHub forever, it just seems
like a nice way to send quick patches -- it is visual and allows full
file/patch download. So this time full patch also included below for
future reference.)

Michal


--- a/tex/context/base/mkxl/lpdf-wid.lmt
+++ b/tex/context/base/mkxl/lpdf-wid.lmt
@@ -259,7 +259,7 @@ local function flushembeddedfiles()
 for tag, reference in sortedhash(filestreams) do
 if not reference then
 report_attachment("unreferenced file, tag %a",tag)
-elseif referenced[tag] == "hidden" then
+elseif referenced[tag] == "hidden" or referenced[tag] == "forced" 
then
 e[#e+1] = pdfstring(tag)
 e[#e+1] = reference -- already a reference
 f[#f+1] = reference -- collect all file description references
@@ -369,6 +369,9 @@ function codeinjections.embedfile(specification)
 }
 local r = pdfreference(pdfflushobject(d))
 filestreams[hash] = r
+if specification.forcereference == true then
+referenced[hash] = "forced"
+end
 return r
 end
 end
@@ -705,9 +708,10 @@ local function insertrendering(specification)
 descriptor = pdfreference(pdfflushobject(descriptor))
 elseif option[v_embed] then
 descriptor = codeinjections.embedfile {
-file = filename,
-mimetype = mimetype, -- yes or no
-compress = false,
+file   = filename,
+mimetype   = mimetype, -- yes or no
+compress   = false,
+forcereference = true,
 }
 end
 local clip = pdfdictionary {
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] multimedia PDF in ConTeXt

2021-07-30 Thread Pablo Rodriguez via ntg-context
Hi Michal and Hans,

many thanks for your patch to fix multimedia objects in PDF and your
extremely interesting and in-depth explanation about multimedia in PDF.
Many thanks to Hans for the release of an updated latest with also
updated documentation.

Although I don’t read Czech, just out of curiosity, is your bachelor
thesis available on the net, Michal? Thanks to theses.cz, I found
https://is.muni.cz/th/t8qpp/DP_Vlasak_Michal_2015.pdf (only a name
coincidence, I guess).

Using your sample, I have two questions:

  \starttext
  \setupinteraction[state=start]

  \useexternalrendering[myvideo][video/mp4][video.mp4][embed=yes]

  \definerenderingwindow[myrenderingwindow]
[width=\textwidth, height=\textwidth]

  \placerenderingwindow[myrenderingwindow][myvideo]
  \stoptext

Is there no way to have the video as an embedded file in the PDF
document? (I mean, that the file is listed when the attachment panel is
displayed.)

The second question is addressed to Hans: would it be possible that
\placerenderingwindow could have another option and text as in \framed?
A workaround would be to add a layer, but too complex only for adding
usage instructions for the media usage.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Multimedia, PDF and ConTeXt

2021-07-27 Thread Hans Hagen via ntg-context

On 7/27/2021 1:20 PM, Michal Vlasák wrote:


I thought that recent Edge versions used Chrome's PDFium, as you say
with some additions (like drawing). I would have to double check that.


yes but i think with their own additions (not sure about the pdf stuff)

i do notice differences in printing so maybe that part is also different


My understanding is that U3D was the first thing they designed. It is
standardised by ECMA, so freely available. Then they came up with PRC,
which should be more space efficient IIRC. It is standardized by ISO, so
it is open, but not free.

Both formats seemed to worked fine in Acrobat and Foxit and I don't see
that changing soon.

Both have some writing support in open source tools - meshlab supports
U3D export with https://github.com/ningfei/u3d, and Asymptote supports
PRC export. Although I didn't get either to quite work and used export
from Autodesk Inventor instead for my tests.


ok, so that might stay


Not fully official, but it is only logical that they need a compatibility
layer for old documents. But, Adobe employee mentionts the use of OS Player
for these Flash using documents here:

https://community.adobe.com/t5/acrobat-reader/playing-embedded-video-without-flash/td-p/11266205/page/2


ok


Do you mean table summarizing what parts of the Acrobat JavaScript API
is supported in individual viewers?

There is a separate API for normal things:

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf


ok


Do you mean existing PDFs that work in viewers or ConTeXt source files
that use these features? I can provide both.


good


I am not sure what you mean by "small set of files for media".


proper freely distributable test files

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Multimedia, PDF and ConTeXt

2021-07-27 Thread Michal Vlasák via ntg-context
On Tue Jul 27, 2021 at 8:54 AM CEST, Hans Hagen wrote:
> On 7/27/2021 12:49 AM, Michal Vlasák via ntg-context wrote:
>
> > The viewers I tested were: Acrobat Reader DC, Foxit Reader, Sumatra PDF
> > on Windows and Evince, Okular, Xpdf, MuPDF, Firefox and Google Chrome on
> > Linux.
>
> also add the new edge on windows .. there are subtle differences in
> interfaces; although it doesn't fit into this topic, printing is also
> somethign to pay attention to; browser based pdf's can crash (mem
> consumption), the sometimes present doubleside directive can also
> confuse viewers

I thought that recent Edge versions used Chrome's PDFium, as you say
with some additions (like drawing). I would have to double check that.

From what I tried, from the tested viewers only Acrobat seemed to do
something with the double sided directive, if

/ViewerPreferences <<
/Duplex /DuplexFlipLongEdge
>>

is what we are talking about.

> when it comes to checking you need to keep in mind that some readers
> start top-down (collect objects), others bottom up (xref), some use a
> mix, some apply heuristics (irr xpdf did something with t1 fonts that
> made cut/paste an issue), some are tolerant, others more strict,
> treatment of updates objects can differ, but not always consistent ...
> so, that also makes testing annotations a problem

Yeah, I noticed that some viewers have no problem with broken xref,
others do -- that is surely the symptom of top to bottom and bottom to
top as well as the tolerance.

I only tested with simplistic and mostly hand crafted documents with a
few objects. No updates. I was concerned with creating PDF with
annotations, not with adding them afterwards. (For some annotations both
make sense, not much for others.)

Although I noticed when I tried to add annotations that Acrobat didn't
even use the object generation numbers, but just added new objects.

> > 3) Multimedia ("Renditions")
> >
> > [...]
> >
> > This mechanism allows multimedia player controls, as well as PDF
> > actions. The PDF action can be either one of the predefined ones or
> > entirely specified in JavaScript (extra API is available for this).
>
> brings us to javascript ... it would be interesting to have the 'minimal
> useful' set of support needed; mupdf has javascript but nto realaly for
> annotations (for instance the ability to control layers and widget
> states would be nice ... it's trivial to program in viewers i bet)

I also looked into JavaScript. Exactly as you say MuPDF has JavaScript,
but only for forms. Firefox and Chrome also have JavaScript support, but
again mostly for forms.

None of the three support normal (not forms) JavaScript PDF actions.
Adding support presumably wouldn't be hard -- they already support some
of the API, they just don't allow it from these actions (but they do
allow Document Level JavaScript).

As you know, the JavaScript engine used in MuPDF has very Lua like C
API, so I too think that adding JavaScript API for something already
implemented in the viewer should be easy.

> > 4) 3D art
> > 
> >   - First appeared in PDF 1.6 (2004).
> > 
> >   - Only 3D files supported. This means U3D and later PRC files. The 3D
> > objects described in the files are shown in a scene whose parameters
> > (like camera position, angle, background color, etc.) can be
> > configured.
> > 
> >   - The source is not a file, but a "PDF stream" (which is essentially
> > embedded file with different metadata, but allows also "external
> > files" to contain the stream data).
> > 
> >   - The 3D functionality is nice. It allows great amount of interactivity
> > (playing with the camera, selectively disabling 3D objects, etc.) and
> > also scriptability (switching between predefined "views" with PDF
> > actions and a _lot_ of possibilities with JavaScript scripts).
> > 
> >   - This is the mechanism used for u3d and prc files in the ConTeXt
> > "figure" mechanism (\externalfigure).
> > 
> >   - Apart from the external streams (see above) everything works in Adobe
> > Acrobat. Foxit Reader also has support, but it is limited (no
> > support for JavaScript and printing).
>
> Wasn't that driven by apps like autocad? Is U3D kind of a standard that
> will stay?

My understanding is that U3D was the first thing they designed. It is
standardised by ECMA, so freely available. Then they came up with PRC,
which should be more space efficient IIRC. It is standardized by ISO, so
it is open, but not free.

Both formats seemed to worked fine in Acrobat and Foxit and I don't see
that changing soon.

Both have some writing support in open source tools - meshlab supports
U3D export with https://github.com/ningfei/u3d, and Asymptote supports
PRC export. Although I didn't get either to quite work and used export
from Autodesk Inventor instead for my tests.

> > 5) Rich Media
> > 
> >[...]
> >
> > The old idea was that the PDF viewer would support Flash (and 

Re: [NTG-context] Multimedia, PDF and ConTeXt

2021-07-27 Thread Hans Hagen via ntg-context

On 7/27/2021 12:49 AM, Michal Vlasák via ntg-context wrote:


The viewers I tested were: Acrobat Reader DC, Foxit Reader, Sumatra PDF
on Windows and Evince, Okular, Xpdf, MuPDF, Firefox and Google Chrome on
Linux.


also add the new edge on windows .. there are subtle differences in 
interfaces; although it doesn't fit into this topic, printing is also 
somethign to pay attention to; browser based pdf's can crash (mem 
consumption), the sometimes present doubleside directive can also 
confuse viewers


when it comes to checking you need to keep in mind that some readers 
start top-down (collect objects), others bottom up (xref), some use a 
mix, some apply heuristics (irr xpdf did something with t1 fonts that 
made cut/paste an issue), some are tolerant, others more strict, 
treatment of updates objects can differ, but not always consistent ... 
so, that also makes testing annotations a problem


the command line program qpdf is one of the best programs to check (when 
luigi sand i were checking luatex pdf issues we used qpdf and mupdf mostly)



Now to the different mechanisms:

1) Sound objects

  - First appeared in PDF 1.2 (1996), but had since been deprecated (PDF
1.5, 2003) and became unsupported (PDF 2.0, 2017).

  - Only audio is supported.

  - "Raw" and in practice uncompressed PCM audio can be embedded (i.e.
".wav" format without the metadata).
Otherwise an external file may be used (this one has to be in a real
audio format - like ".wav" - i.e. with metadata).

  - Users usually don't have raw audio. So embedding requires
preprocessing. Some control using PDF actions is possible.

  - Not supported in ConTeXt.
  - None of the viewers supports the external files. Only Acrobat Reader
supports the embedded raw audio.


amazing right? all that talk of accessibility and no proper easy audio 
support



2) Movie objects

  - First appeared in PDF 1.2 (1996), but had since been deprecated (PDF
1.5, 2003) and became unsupported (PDF 2.0, 2017).

  - Both video and audio is supported.

  - Any source (embedded, external and URL file).

  - In all regards superior to sound objects. Is still relatively simple
and allows some customization and control (media player controls, PDF
actions).

  - This is the backing mechanism for including video and audio in
ConTeXt (\externalfigure, \useexternalsoundtrack).

  - Supported only in Evince and Okular (with their usual quirks, see
below). Notably Acrobat Reader does no longer support this mechanism.


this all became an issue when they dropped the quicktime plugin 
(probably also relates to the usual big companies competing politics)



3) Multimedia ("Renditions")

  - First appeared in PDF 1.5 (2003). Adobe Acrobat considers them
"legacy".

  - Both video and audio supported (as well as other unspecified types of
multimedia, like images and Flash, but not really, see below).

  - In theory all source types should be possible.

  - This mechanism was supposed to replace sound and movie objects. Hence
their deprecation. The mechanism is complex (the spec is 10 times
longer than that for movie objects). It expects the PDF viewers to
work with plugins and introduces ways for determining if a media file
is really playable in some plugin. It is allowed to even include
more media files (to serve as fallback should the primary one be
unsupported by the viewer). Other complexity is that the concept of
the rectangle where the media will be played ("screen") is separated
from the media itself ("rendition"). In theory this allows mixing and
matching them, but in practice is a lot of unnecessary complexity, at
least in my opinion.


I fully agree. As with many of these annotation pdf things it's probably 
reversed engeneered from some application or plugin, not the result of 
clear design. It also evolves when there is no way to generate it (tex 
is often one of the first to do that and then we run into specs not 
fitting reality). Kind of making equipment that should work on mars and 
test it on earth (if at all).



This mechanism allows multimedia player controls, as well as PDF
actions. The PDF action can be either one of the predefined ones or
entirely specified in JavaScript (extra API is available for this).


brings us to javascript ... it would be interesting to have the 'minimal 
useful' set of support needed; mupdf has javascript but nto realaly for 
annotations (for instance the ability to control layers and widget 
states would be nice ... it's trivial to program in viewers i bet)



  - This is the mechanism behind \useexternalrendering. This has been
used for Flash (.swf files) and "manual" audio + video insertion as
far as I can tell.

  - Evince and Okular support this (with usual quirks), but not for
external files (Evince segfaults). Acrobat and Foxit support this
mechanism as well, but Acrobat only allows embedded files. Okular by
   

[NTG-context] Multimedia, PDF and ConTeXt

2021-07-26 Thread Michal Vlasák via ntg-context
Dear ConTeXt community,

recently, as part of my bachelor thesis, I looked into the state of
multimedia (audio, video, 3D) and other relatively obscure PDF
features, with the connection to TeX.

I already put off this write up long enough. Hopefully it clarifies
things that might influence the current uncertainty about these features
and their presence in ConTeXt (see abstract of Hans' talk for upcoming
ConTeXt meeting, chapter 8 of "On and on" and remarks in files like
"lpdf-wid.lmt").

The following text discusses the options for including multimedia in PDF
files from ConTeXt. First the different PDF mechanisms are introduced
and compared, then their support in ConTeXt is summarized. My ideas
for future steps are also included. Patch to fix some bugs is also
below. Lastly I link to some resources regarding the topic.

The various versions of the PDF standard have over the years developed
several ways of including "multimedia" in PDF files. The simplest are
XObjects which allow raster and vector graphics -- this is a well known
and well supported feature in both PDF writers and viewers. However,
later revisions of the PDF standard added what is essentially five
different mechanisms for including video, audio or 3D files (each
mechanism supports a different subset of these three). For evaluating
these mechanisms from perspective of ConTeXt it is possible to devise
the following criteria:

 - support in PDF standard (deprecation, etc.),
 - supported media types (audio, video[+optional audio], 3D),
 - support of different source types (embedded file, external file, URL)
 - what is possible to achieve ("usefulness") and at what cost
   ("complexity"),
 - current support in ConTeXt,
 - and the most important: support in PDF viewers.

Perhaps the "source types" need a bit of explanation. Essentially all
file references from PDF can be one of three types:

 - Embedded file. The referenced file is *in* the PDF file, this means
   that it can also be compressed as part of it (not very useful for
   multimedia though). This is nice because the result is integral --
   the media file can't get lost and there is only a single file to
   distribute.
 - URL file. The reference to the file is solely the URL. Takes almost
   no space at all in the PDF file, but means that the availability of
   the media file and PDF file are not tied.
 - External file. A file path is included in the PDF file. The file
   doesn't have to be available over the internet, but has to be
   distributed along with the PDF file (and the relative path has to
   match).

The "usefulness" aspect includes the possibility of interaction or
scripting. E.g. using media player buttons ("controls"), scripting with
JavaScript or some control with PDF actions (\goto, and triggers like
page open which allow auto-play).

The viewers I tested were: Acrobat Reader DC, Foxit Reader, Sumatra PDF
on Windows and Evince, Okular, Xpdf, MuPDF, Firefox and Google Chrome on
Linux.

Now to the different mechanisms:

1) Sound objects

 - First appeared in PDF 1.2 (1996), but had since been deprecated (PDF
   1.5, 2003) and became unsupported (PDF 2.0, 2017).

 - Only audio is supported.

 - "Raw" and in practice uncompressed PCM audio can be embedded (i.e.
   ".wav" format without the metadata).
   Otherwise an external file may be used (this one has to be in a real
   audio format - like ".wav" - i.e. with metadata).

 - Users usually don't have raw audio. So embedding requires
   preprocessing. Some control using PDF actions is possible.

 - Not supported in ConTeXt.

 - None of the viewers supports the external files. Only Acrobat Reader
   supports the embedded raw audio.

2) Movie objects

 - First appeared in PDF 1.2 (1996), but had since been deprecated (PDF
   1.5, 2003) and became unsupported (PDF 2.0, 2017).

 - Both video and audio is supported.

 - Any source (embedded, external and URL file).

 - In all regards superior to sound objects. Is still relatively simple
   and allows some customization and control (media player controls, PDF
   actions).

 - This is the backing mechanism for including video and audio in
   ConTeXt (\externalfigure, \useexternalsoundtrack).

 - Supported only in Evince and Okular (with their usual quirks, see
   below). Notably Acrobat Reader does no longer support this mechanism.

3) Multimedia ("Renditions")

 - First appeared in PDF 1.5 (2003). Adobe Acrobat considers them
   "legacy".

 - Both video and audio supported (as well as other unspecified types of
   multimedia, like images and Flash, but not really, see below).

 - In theory all source types should be possible.

 - This mechanism was supposed to replace sound and movie objects. Hence
   their deprecation. The mechanism is complex (the spec is 10 times
   longer than that for movie objects). It expects the PDF viewers to
   work with plugins and introduces ways for determining if a media file
   is really playable in some plugin. It is allowed to even include