What is the purpose of the 'vedt' chunk in an AVI file? - codec

In some AVI files, there's a chunk named 'vedt' placed at the end of the header. You can download one of these files here: https://samples.mplayerhq.hu/V-codecs/RLE/filecopy.avi . In this example, the contents of the chunk in question are just zero. There are also other files of the same nature within the sample directory. However, https://samples.mplayerhq.hu/V-codecs/RLE/filedelr.avi contains some non-zero values within the 'vedt' chunk.
Does this have something to do with masking the background so it can played with a user-defined background? that's what I suspect.

Related

Convert multiple AVI files to JPEG

I am trying to convert multiple (250 or so) .avi video files into .jpeg files with R.
I have managed to convert single .avi files using function av_video_images() from library av, but I would love to know how to iterate this over multiple input files.
av::av_video_images("FILE001.AVI", destdir = "Site_1_JPEG", format = "jpg", fps = 1)
I have the 250 .avi files in a folder and would like all frames produced in the output folder Site_1_JPEG.
This is not a complete solution since I cannot reproduce your issue, but I think it will get you closer. Your example suggests that the files you want to process are in your current working directory. Secondly, your code will not produce the desired results because av_video_images names the .jpg files as "image_000001.jpg", "image_000002.jpg", "image_000003.jpg" and I see no way to alter the names of the extracted jpg's. That means your code will successively overwrite the previous files and at the end you will only have the final set of jpg's. To prevent that you need to create separate folders for each video file. Here is one solution:
library(av)
sapply(flist[1:3], function(x) av_video_images(paste0(path, x), x, fps=.5))
To test the code I specified that only the first 3 files will be processed to check things out. There are two differences between my code and yours. First my video files are located in a different directory (path) so I pasted the path onto the file name. Second I provided a different destination directory for each file which is just the file name. This produced three folders with jpg files in each.
The error message could indicate that one or more of the .avi files is corrupt. You can get the directory information on all of the files with
file.info(flist)
The main thing to look at is the size column to make sure the size is large enough.

Is there a way to compare the structure/architecture of .nc files in R?

I have a sample .nc file that contains a number of variables (5 to be precise) and is being read into a program. I want to create a new .nc file containing different data (and different dimensions) that will also be read into that program.
I have created a .nc file that looks the same as my sample file (I have included all of the necessary attributes for each of the variables that were included in the original file).
However, my file is still not being ingested.
My question is: is there a way to test for differences in the layout/structure of .nc files?
I have examined each of the variables/attributes within Rstudio and I have also opened them in panoply and they look the same. There are obviously differences (besides the actual data that they contain) since the file is not being read.
I see that there are options to compare the actual data within .nc files online (Comparison of two netCDF files), but that is not what I want. I want to compare the variable/attributes names/states/descriptions/dimensions to see where my file differs. Is that possible?
The ideal situation here would be to create a .nc template from the variables that exist within the original file and then fill in my data. I could do this by defining the dimensions (ncdim_def), creating the file(nc_create), getting my data (ncvar_get) and putting it in the file (ncvar_put), but that is what I have done so far, and it is too reliant on me not making an error (which I obviously have as they are not the same).
If you are on unix this is more easily achieved using CDO. See the Information section of the reference card: https://code.mpimet.mpg.de/projects/cdo/embedded/cdo_refcard.pdf.
For example, if you wanted to check that the descriptions are the same in files just do:
cdo griddes example1.nc
cdo griddes example2.nc
You can easily use system in R, to wrap around this.

Can I generate separate HTML file for each header using rmarkdown::render()?

I generate reports using rmarkdown::render() function on a list of .Rmd files and I get one HTML file for each of them.
That was fine until my dataset got bigger and my reports now contain >100 figures... The HTML files often end-up being >100MB and I now have some very big ones (~500MB).
The .Rmd is separated in several chunks so one might think I have to split my .Rmd in smaller files (let's say one chunk per file).
This is not (easily) doable because the .Rmd defines a data-processing workflow (figures generated in chunk3 require processings made in chunk1 and chunk2).
I would like to know if it is possible to split the rendering in several HTML files automatically.
Ideally I dream about a 'splitHeader' argument in render() that would generate separate HTML file for each header of a specified level.
I guess an ugly solution is to manually add conditional statements for every chunk/header that I would like rendered (or not), and call render() several time with different arguments. But this is extremely inefficient (and ugly, I said that already)...
Would somebody have suggestions to achieve that ?
I am not sure if this solve (or at least help to solve): You can have multiple independent .Rmd files (childs) dividing the content as you like. In a "Mother" file, you can add the child using:
```{r child = "yourChild.Rmd"}
```
The child .Rmd files should no contain any header information. That is, delete the first lines in you .Rmd that are something like:
---
title: "Your Title"
author: "Your name"
output: html_notebook
---

file.append fails to aggregate .rtf files

I have used file.create and file.append successfully to aggregate multiple .txt files. When I try it with .rtf files, however, I get a larger rtf file that only shows the contents of the first .rtf of many to be aggregated.
So I have 5 .rtf files, for example. dirFiles is the list of names to be aggregated:
file.create(fileCollection_r)
file.append(fileCollection_r,dirFiles_r)
Is this a bug, and I would I report it?
How can I aggregate multiple .rtf files?
First of all, it is not clear what file.create() resp. append is doing. You didn't tag for a specific programming language, so that part of your question is really unclear and you need to improve that.
Having said that: RTF files, are in the end, pure text files. They contain formatting information, such as
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf100
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
So, theoretically, you can just pull that text content from multiple RTF files, and put all of that into a single file.
Thus: simple use a file viewer, such as less, cat, or some windows/macos pendant, and A) check the textual content of your single RTF files and B) check out the textual content of the file that you created this way. That will tell you if the pure textual append did work.
But beyond that: it could very well be that the RTF format itself has certain limitations, that simply make it not possible to just append arbitrary RTF file content and end up with something that works as a correct RTF document.

Automation of images to PDF at District level

I want create a PDF with 5 Images from 5 folder with text. First I want to read the district name from CSV file and check the same file name in each folder. Second if the file name are matching, Make a PDF with the five images and CSV name as title for the PDF page and text which will be common for all the PDF. I want to give particular font and size, border for images, border for text also. I want to repeat for n number of districts. Is it possible with LaTeX or python?? Can anyone help me please, I am new to coding.
Thanks in advance.
In LaTeX including graphics is done with: \includegraphics and it's fairly straightforward. You can find a number of examples on the linked page above that will walk you through setting the pathname to each of your folders as necessary. There's also a good answer here about how to set multiple pathways in the declaration of your document. As a general note, LaTeX will definitely be more flexible with making pdfs than either r or LaTeX because that's what it was built for.

Resources