rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.88k stars 979 forks source link

Video file is not implemented properly when creating a pptx from rmarkdown. #2205

Open JohnCamus opened 3 years ago

JohnCamus commented 3 years ago

I tried embedding a video into my power point presentations for work, I tried

Here is a minimal reproducible script

---
title: "Markdown killed the video star(?)"
author: John Doe
date: March 22, 2005
output: powerpoint_presentation
---

## Images seem to work

![demo1](demo.PNG)

## mp4 however, does not

![demo1](demo.mp4)

## even with this approach

<video width="320" height="240" controls >
  <source src="demo.mp4" type="video/mp4">
</video>

## even if i use the example link, nothing happens:
![test](https://www.youtube.com/watch?v=zNzZ1PfUDNk)

This is the output I get: grafik

The XML Discrepancies

I saved the r generated version as xml and another version as xml where I inserted the video manually, I then compared the xml data from both presentations, it seems there are some information missing in the xml file that is generated via R. The red elements are present in the manually generated presentation, saved as an xls, but not present in the presentation, generated by R. grafik

The R-Project Folder

Here is the R-Project folder. It contains the script a picture, and a video ppt_with_video.zip

Session Info

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043), RStudio 1.4.1106

Locale:
  LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
  LC_TIME=German_Germany.1252    

Package version:
  base64enc_0.1.3   digest_0.6.27     evaluate_0.14     glue_1.4.2        graphics_4.0.5    grDevices_4.0.5   highr_0.9        
  htmltools_0.5.1.1 jsonlite_1.7.2    knitr_1.33        magrittr_2.0.1    markdown_1.1      methods_4.0.5     mime_0.10        
  rlang_0.4.11      rmarkdown_2.8     stats_4.0.5       stringi_1.5.3     stringr_1.4.0     tinytex_0.31      tools_4.0.5      
  utils_4.0.5       xfun_0.22         yaml_2.2.1       

Pandoc version: 2.11.4`

I tested the script after updating all the packages and installing the developement version of rmarkdown, to no avail. EDIT: I changed the XML screenshot to hide my name.

cderv commented 3 years ago

Hi !

Thanks for the report.

This is possibly a current limitation of Pandoc that rmarkdown uses. If I used pandoc directly using this command

pandoc -t pptx -o test.pptx .\anotherdemo.Rmd

We get an output without video. The part using HTML is obviously ignored for a pptx output but the other part should probably work.

@apreshill you could be interested by this re: the Powerpoint work in Pandoc. It seems that currently this is not supported by Pandoc. However, I did not found any issue in the repo on this topic.

cderv commented 2 years ago

This is definitely something for Pandoc to support. I have opened an issue there: https://github.com/jgm/pandoc/issues/7773