title: How to embed an MP4 inside a PDF?
body: <p>I am a happy user of <a href="https://superuser.com/q/687849/106444">img2pdf</a>. This tool does the minimal amount of work to put a series of JPEG 2000/JPEG/PNG images into a PDF &quot;enveloppe&quot;. However I am now faced with a new challenge: embed a MP4 file into a PDF &quot;enveloppe&quot;.</p>
  <p>I see that commercial tool can do it, as seen at:</p>
  <ul>
  <li><a href="https://helpx.adobe.com/acrobat/using/rich-media.html" rel="nofollow noreferrer">Add audio, video, and interactive objects to PDFs</a></li>
  </ul>
  <p>Here is one such sample PDF file (no Flash required on windows in this sample):</p>
  <ul>
  <li><a href="https://gitlab.com/agrahn/media9/-/issues/9#note_345903962" rel="nofollow noreferrer">https://gitlab.com/agrahn/media9/-/issues/9#note_345903962</a>
  <ul>
  <li><a href="https://gitlab.com/agrahn/media9/uploads/90fddd777e0ec514c39c924cd8d3b688/video_test.pdf" rel="nofollow noreferrer">https://gitlab.com/agrahn/media9/uploads/90fddd777e0ec514c39c924cd8d3b688/video_test.pdf</a></li>
  </ul>
  </li>
  </ul>
  <p>It seems to have been introduced in ISO 32000-1 (<a href="http://www.adobe.com/devnet/acrobat/pdfs/adobe_supplement_iso32000_1.pdf" rel="nofollow noreferrer">PDF 1.7 Extension Level 5</a>)</p>
  <p>I am looking for a solution which will use the <em>Rich Media annotation</em> inside the PDF stream.</p>
  <p>There are dozen of duplicated questions on superuser/stackoverflow, which all pretty much refer to imagemagick/convert command line tool. But in my case, <code>convert</code> expand the images into a multi-page PDF (which is not my desired behavior):</p>
  <pre><code>$ convert input.mp4 output.pdf
  $ pdfinfo output.pdf 
  Title:          out
  Producer:       https://imagemagick.org
  CreationDate:   Wed Aug 19 15:38:01 2020 CEST
  ModDate:        Wed Aug 19 15:38:01 2020 CEST
  Tagged:         no
  UserProperties: no
  Suspects:       no
  Form:           none
  JavaScript:     no
  Pages:          1601
  Encrypted:      no
  Page size:      352 x 288 pts
  Page rot:       0
  File size:      534407296 bytes
  Optimized:      no
  PDF version:    1.3
  </code></pre>
  <p>with:</p>
  <pre><code>$ convert --version
  Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
  Copyright: © 1999-2019 ImageMagick Studio LLC
  License: https://imagemagick.org/script/license.php
  Features: Cipher DPC Modules OpenMP 
  Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
  </code></pre>
  <p>and</p>
  <pre><code>$ file input.mp4 
  input.mp4: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]
  $ ffprobe -v quiet -print_format json  -show_streams input.mp4 | grep codec_long_name
              &quot;codec_long_name&quot;: &quot;H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10&quot;,
  </code></pre>
  <p>How would you embed an MP4 inside a PDF now that Flash support is being removed from Acrobat (Dec 2020) ? The solution should be on the command line (linux based system).</p>