A methodological tutorial in Python for automated content analysis of digital videos using artificial intelligence

preprint OA: closed
Full text JSON View at publisher
Full text 10,863 characters · extracted from preprint-html · click to expand
A methodological tutorial in Python for automated content analysis of digital videos using artificial intelligence | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Method Article A methodological tutorial in Python for automated content analysis of digital videos using artificial intelligence Carlos A. Almenara This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-8817867/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Background . The exponential growth of short social media videos has created new opportunities for research. Nevertheless, traditional video content analysis remains labor-intensive and therefore difficult to scale. This methodological paper provides a practical step-by-step tutorial for conducting automated content analysis of digital videos using a multimodal large language model (LLM, Gemini 3 Pro) via an application programming interface (API). Methods . Using Python in a cloud notebook environment, we demonstrate how to (1) collect a public dataset of TikTok videos, (2) upload videos to Google API Files, (3) apply a codebook-based prompt to extract structured variables, (4) enforce the outputs to a JSON template, (5) implement robust error handling and reprocessing logic, and (6) export results for statistical analysis. The tutorial is illustrated with an open dataset of 1,028 TikTok videos on weight loss, yielding one JSON record per video that includes video description, topic classification, and identification of explicit weight-loss product advertising, plus additional attributes (e.g., framing, identity, narrative type, call to action) when advertising is detected. Results . The full run produced 1,028 JSON files in 11.39 hours at a cost of USD $20.27 dollars. Human–LLM coding agreement, assessed on a random subset using Krippendorff’s alpha, was high (mean 94.87%). Conclusion . The provided Python code and results demonstrate that the method employed here is very useful and can be escalated to analyze thousands if not hundreds of thousands of short digital videos. artificial intelligence automated content analysis large language models prompt engineering social media analytics video content analysis Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-8817867","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Method Article","associatedPublications":[],"authors":[{"id":600661500,"identity":"a74c4127-7846-4348-b1e3-f55f80490565","order_by":0,"name":"Carlos A. Almenara","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA80lEQVRIiWNgGAWjYHACxgMgkg/KkyNKD1gLG5RjTLqWxAZCyvnbzz448OEPgzyb2OFjD37usUvfcLv5AXNBBW4tEmfSDQ7ObGMwbJNOSzfseZacu+HOMQPmGWdwazFgSGM4zNvAwNgmnWMmwXOAOXfDjRwGZt42PFr4nzEc5vnDYN8mnf9N8s+B+nQDsJZ/eLRIAG3hYWNIBNrCJs1z4HACRAueQJC48YwB6BeJZKBfzKRlDhw3nAn0y+EZx3Br4e9PY3zw4Y+Nbb908jPJNweq5fluNz98XFCDWwvMMlT2YYIaMLQzk6hlFIyCUTAKhjcAAIBmTth4aFNUAAAAAElFTkSuQmCC","orcid":"","institution":"Universidad Peruana de Ciencias Aplicadas","correspondingAuthor":true,"prefix":"","firstName":"Carlos","middleName":"A.","lastName":"Almenara","suffix":""}],"badges":[],"createdAt":"2026-02-07 20:23:07","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-8817867/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-8817867/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":105904632,"identity":"e4a2cc8b-858e-4ecb-92d9-d825b8d0fda2","added_by":"auto","created_at":"2026-04-01 10:09:59","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":593656,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8817867/v1_covered_1580b6ba-796a-408b-b742-58dda81b5b82.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"A methodological tutorial in Python for automated content analysis of digital videos using artificial intelligence","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"artificial intelligence, automated content analysis, large language models, prompt engineering, social media analytics, video content analysis","lastPublishedDoi":"10.21203/rs.3.rs-8817867/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-8817867/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003e\u003cem\u003e\u003cstrong\u003eBackground\u003c/strong\u003e\u003c/em\u003e. The exponential growth of short social media videos has created new opportunities for research. Nevertheless, traditional video content analysis remains labor-intensive and therefore difficult to scale. This methodological paper provides a practical step-by-step tutorial for conducting automated content analysis of digital videos using a multimodal large language model (LLM, Gemini 3 Pro) via an application programming interface (API).\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003eMethods\u003c/strong\u003e\u003c/em\u003e. Using Python in a cloud notebook environment, we demonstrate how to (1) collect a public dataset of TikTok videos, (2) upload videos to Google API Files, (3) apply a codebook-based prompt to extract structured variables, (4) enforce the outputs to a JSON template, (5) implement robust error handling and reprocessing logic, and (6) export results for statistical analysis. The tutorial is illustrated with an open dataset of 1,028 TikTok videos on weight loss, yielding one JSON record per video that includes video description, topic classification, and identification of explicit weight-loss product advertising, plus additional attributes (e.g., framing, identity, narrative type, call to action) when advertising is detected.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003eResults\u003c/strong\u003e\u003c/em\u003e. The full run produced 1,028 JSON files in 11.39 hours at a cost of USD $20.27 dollars. Human–LLM coding agreement, assessed on a random subset using Krippendorff’s alpha, was high (mean 94.87%).\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003eConclusion\u003c/strong\u003e\u003c/em\u003e. The provided Python code and results demonstrate that the method employed here is very useful and can be escalated to analyze thousands if not hundreds of thousands of short digital videos.\u003c/p\u003e","manuscriptTitle":"A methodological tutorial in Python for automated content analysis of digital videos using artificial intelligence","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-03-06 04:42:41","doi":"10.21203/rs.3.rs-8817867/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"65fee7c6-94b5-419e-a721-812c2c804e4a","owner":[],"postedDate":"March 6th, 2026","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2026-03-31T05:56:06+00:00","versionOfRecord":[],"versionCreatedAt":"2026-03-06 04:42:41","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-8817867","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-8817867","identity":"rs-8817867","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2026) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00