René's URL Explorer Experiment


Title: Question regarding the frame rate options (seems inconsistent with ffmpeg command-line) · python-ffmpegio/python-ffmpegio · Discussion #50 · GitHub

Open Graph Title: Question regarding the frame rate options (seems inconsistent with ffmpeg command-line) · python-ffmpegio/python-ffmpegio · Discussion #50

X Title: Question regarding the frame rate options (seems inconsistent with ffmpeg command-line) · python-ffmpegio/python-ffmpegio · Discussion #50

Description: Question regarding the frame rate options (seems inconsistent with ffmpeg command-line)

Open Graph Description: Thanks for this nice project! I have a question regarding the framerate change. For example, import ffmpegio with ffmpegio.open( "test_video.mp4", mode="rv", r=24, pix_fmt="rgb24", ) as videostream...

X Description: Thanks for this nice project! I have a question regarding the framerate change. For example, import ffmpegio with ffmpegio.open( "test_video.mp4", mode="rv", r=24, pix_fmt="...

Opengraph URL: https://github.com/python-ffmpegio/python-ffmpegio/discussions/50

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Question regarding the frame rate options (seems inconsistent with ffmpeg command-line)","text":"\u003cp dir=\"auto\"\u003eThanks for this nice project! I have a question regarding the framerate change. For example,\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"import ffmpegio\n\nwith ffmpegio.open(\n    \u0026quot;test_video.mp4\u0026quot;,\n    mode=\u0026quot;rv\u0026quot;,\n    r=24,\n    pix_fmt=\u0026quot;rgb24\u0026quot;,\n) as videostream, ffmpegio.open(\n    \u0026quot;low_fps.mp4\u0026quot;,\n    \u0026quot;wv\u0026quot;,\n    rate_in=24,\n    format=\u0026quot;mp4\u0026quot;,\n    vcodec=\u0026quot;libx264\u0026quot;,\n    pix_fmt=\u0026quot;yuv420p\u0026quot;,\n    overwrite=True,\n) as videoout:\n    for frame in videostream:\n        videoout.write(frame)\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003eimport ffmpegio\n\nwith ffmpegio.open(\n    \"test_video.mp4\",\n    mode=\"rv\",\n    r=24,\n    pix_fmt=\"rgb24\",\n) as videostream, ffmpegio.open(\n    \"low_fps.mp4\",\n    \"wv\",\n    rate_in=24,\n    format=\"mp4\",\n    vcodec=\"libx264\",\n    pix_fmt=\"yuv420p\",\n    overwrite=True,\n) as videoout:\n    for frame in videostream:\n        videoout.write(frame)\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eI have a test_video.mp4 with 60fps, I'm trying to convert it to 24fps without changing the playback time. This means I need to drop some frames for the new framerate. Surprisingly, I find the above code seems working well. However, if I use \u003ccode class=\"notranslate\"\u003effmpeg -r 24 -i test_video.mp4 low_fps.mp4\u003c/code\u003e, the video won't drop any frame but the output video will have longer playback time. I assume the \u003ccode class=\"notranslate\"\u003e-r\u003c/code\u003e in ffmpegio here performs differently to ffmpeg command-line? I would be appreciated if you have any insight, thanks!\u003c/p\u003e","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"\u003cp dir=\"auto\"\u003e\u003ca class=\"user-mention notranslate\" data-hovercard-type=\"user\" data-hovercard-url=\"/users/buggyyang/hovercard\" data-octo-click=\"hovercard-link-click\" data-octo-dimensions=\"link_type:self\" href=\"https://github.com/buggyyang\"\u003e@buggyyang\u003c/a\u003e - Glad you found it useful, and I moved this conversation to Discussions as it is not an \u003ccode class=\"notranslate\"\u003effmpegio\u003c/code\u003e issue.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eI assume the -r in ffmpegio here performs differently to ffmpeg command-line?\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eYes and no. Yes, they are different but no because you are invoking the difference.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWhen calling FFmpeg, the option order matters.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWith \u003ccode class=\"notranslate\"\u003effmpeg -r 24 -i test_video.mp4 -\u003c/code\u003e, you're forcing the input to have 24 fps, i.e., play back in slow-mo as you described, because \u003ccode class=\"notranslate\"\u003e-r\u003c/code\u003e here is an input stream option.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf you want to change the framerate, you need to use the output \u003ccode class=\"notranslate\"\u003e-r\u003c/code\u003e option: \u003ccode class=\"notranslate\"\u003effmpeg -i test_video.mp4 -r 24 -\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIn \u003ccode class=\"notranslate\"\u003effmpegio\u003c/code\u003e, if you give an \u003ccode class=\"notranslate\"\u003effmpeg\u003c/code\u003e option name (minus the leading dash \u003ccode class=\"notranslate\"\u003e-\u003c/code\u003e) as your keyword argument then you are defining \u003ccode class=\"notranslate\"\u003effmpeg\u003c/code\u003e output options. By appending \u003ccode class=\"notranslate\"\u003e_in\u003c/code\u003e to the \u003ccode class=\"notranslate\"\u003effmpeg\u003c/code\u003e option name, your keyword argument turns into an \u003ccode class=\"notranslate\"\u003effmpeg\u003c/code\u003e input option. Using \u003ccode class=\"notranslate\"\u003effmpegio.transcode\u003c/code\u003e as an example,\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"ffmpegio.transcode('test_video.mp4','low_fps.mp4',r=24) # equivalent to ffmpeg -i test_video.mp4 -r 24 -\nffmpegio.transcode('test_video.mp4','slow_mo.mp4',r_in=24) # equivalent to ffmpeg -r 24 -i test_video.mp4 -\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003effmpegio.transcode('test_video.mp4','low_fps.mp4',r=24) # equivalent to ffmpeg -i test_video.mp4 -r 24 -\nffmpegio.transcode('test_video.mp4','slow_mo.mp4',r_in=24) # equivalent to ffmpeg -r 24 -i test_video.mp4 -\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis applies everywhere including \u003ccode class=\"notranslate\"\u003effmpegio.open\u003c/code\u003e. Notice that your first call \u003ccode class=\"notranslate\"\u003evideostream\u003c/code\u003e opens with the new output rate (thus dropping excess frames) while the second call \u003ccode class=\"notranslate\"\u003evideoout\u003c/code\u003e with its input rate, which matches the \u003ccode class=\"notranslate\"\u003evideostream\u003c/code\u003e framerate.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eHope this makes sense to you. Also, if you're only transcoding, use the \u003ccode class=\"notranslate\"\u003effmpegio.transcode\u003c/code\u003e as I show above as it's a whole lot faster than the dual-stream \u003ccode class=\"notranslate\"\u003efor\u003c/code\u003e loop solution you have currently.\u003c/p\u003e","upvoteCount":2,"url":"https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263908"}}}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:d3475b08-7157-acb9-8326-21a8e0908d64
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-id84B2:109AD5:2A331B:3AEF21:6AFD739B
html-safe-nonceac2edd71b9909588c2cf11d7e25207732cae95619f1af347cf1d131793adf04d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEIyOjEwOUFENToyQTMzMUI6M0FFRjIxOjZBRkQ3MzlCIiwidmlzaXRvcl9pZCI6Ijg0OTIxNzk2OTA3MzQwNTYzNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac20c1ddf08099e19a8770c8d7081a44bb03bc9f3ca2f141033444ac861fed1b3b
hovercard-subject-tagdiscussion:7021506
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-ffmpegio/python-ffmpegio/50/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/890403698ce83116f754bd9b6e3681687aa115deebd1ade19462c0bba4184ede/python-ffmpegio/python-ffmpegio/discussions/50
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/890403698ce83116f754bd9b6e3681687aa115deebd1ade19462c0bba4184ede/python-ffmpegio/python-ffmpegio/discussions/50
og:image:altThanks for this nice project! I have a question regarding the framerate change. For example, import ffmpegio with ffmpegio.open( "test_video.mp4", mode="rv", r=24, pix_fmt="rgb24", ) as videostream...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee54006cf2b96d1ac260960edd10003132911469ccd1ec99c9803119fe2a4e032
turbo-cache-controlno-preview
go-importgithub.com/python-ffmpegio/python-ffmpegio git https://github.com/python-ffmpegio/python-ffmpegio.git
octolytics-dimension-user_id98168493
octolytics-dimension-user_loginpython-ffmpegio
octolytics-dimension-repository_id355600490
octolytics-dimension-repository_nwopython-ffmpegio/python-ffmpegio
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id355600490
octolytics-dimension-repository_network_root_nwopython-ffmpegio/python-ffmpegio
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5be0bf2b8cf26f8897d31e6bc3c232d328b12a54
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-ffmpegio%2Fpython-ffmpegio%2Fdiscussions%2F50
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-ffmpegio%2Fpython-ffmpegio%2Fdiscussions%2F50
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=python-ffmpegio%2Fpython-ffmpegio
Reloadhttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50
Reloadhttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50
Reloadhttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50
python-ffmpegiohttps://github.com/python-ffmpegio
python-ffmpegiohttps://github.com/python-ffmpegio/python-ffmpegio
Codehttps://github.com/python-ffmpegio/python-ffmpegio
Issues4 (4)https://github.com/python-ffmpegio/python-ffmpegio/issues
Pull requests1 (1)https://github.com/python-ffmpegio/python-ffmpegio/pulls
Discussionshttps://github.com/python-ffmpegio/python-ffmpegio/discussions
Actionshttps://github.com/python-ffmpegio/python-ffmpegio/actions
Projectshttps://github.com/python-ffmpegio/python-ffmpegio/projects
Wikihttps://github.com/python-ffmpegio/python-ffmpegio/wiki
Security and qualityhttps://github.com/python-ffmpegio/python-ffmpegio/security
Insightshttps://github.com/python-ffmpegio/python-ffmpegio/insights
Answered https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263908
tikuma-lsuhschttps://github.com/tikuma-lsuhsc
buggyyang https://github.com/buggyyang
Q&Ahttps://github.com/python-ffmpegio/python-ffmpegio/discussions/categories/q-a
Question regarding the frame rate options (seems inconsistent with ffmpeg command-line) https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#top
buggyyang https://github.com/buggyyang
Answered https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263908
tikuma-lsuhschttps://github.com/tikuma-lsuhsc
Return to tophttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50#top
Please reload this pagehttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50
https://github.com/python-ffmpegio/python-ffmpegio/discussions/50
buggyyang https://github.com/buggyyang
Aug 7, 2024 https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussion-7021506
tikuma-lsuhsc https://github.com/tikuma-lsuhsc
Aug 7, 2024 https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263908
@buggyyanghttps://github.com/buggyyang
View full answer https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263908
Oldest https://github.com/python-ffmpegio/python-ffmpegio/discussions/50?sort=old
Newest https://github.com/python-ffmpegio/python-ffmpegio/discussions/50?sort=new
Top https://github.com/python-ffmpegio/python-ffmpegio/discussions/50?sort=top
Please reload this pagehttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50
https://github.com/python-ffmpegio/python-ffmpegio/discussions/50
SohamTilekar https://github.com/SohamTilekar
Aug 7, 2024 https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263461
Please reload this pagehttps://github.com/python-ffmpegio/python-ffmpegio/discussions/50
https://github.com/python-ffmpegio/python-ffmpegio/discussions/50
tikuma-lsuhsc https://github.com/tikuma-lsuhsc
Aug 7, 2024 https://github.com/python-ffmpegio/python-ffmpegio/discussions/50#discussioncomment-10263908
@buggyyanghttps://github.com/buggyyang
buggyyanghttps://github.com/buggyyang
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-ffmpegio%2Fpython-ffmpegio%2Fdiscussions%2F50
🙏 Q&A https://github.com/python-ffmpegio/python-ffmpegio/discussions/categories/q-a
https://github.com/buggyyang
https://github.com/tikuma-lsuhsc
https://github.com/SohamTilekar
#49https://github.com/python-ffmpegio/python-ffmpegio/issues/49
https://github.com/python-ffmpegio/python-ffmpegio/discussions/50
https://github.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.