{"action":"created","issue":{"url":"https://api.github.com/repos/obsproject/obs-studio/issues/1308","repository_url":"https://api.github.com/repos/obsproject/obs-studio","labels_url":"https://api.github.com/repos/obsproject/obs-studio/issues/1308/labels{/name}","comments_url":"https://api.github.com/repos/obsproject/obs-studio/issues/1308/comments","events_url":"https://api.github.com/repos/obsproject/obs-studio/issues/1308/events","html_url":"https://github.com/obsproject/obs-studio/pull/1308","id":326788320,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkwNzcxMTU4","number":1308,"title":"obs-ffmpeg: Set average framerate in video stream","user":{"login":"RytoEX","id":624931,"node_id":"MDQ6VXNlcjYyNDkzMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/624931?v=4","gravatar_id":"","url":"https://api.github.com/users/RytoEX","html_url":"https://github.com/RytoEX","followers_url":"https://api.github.com/users/RytoEX/followers","following_url":"https://api.github.com/users/RytoEX/following{/other_user}","gists_url":"https://api.github.com/users/RytoEX/gists{/gist_id}","starred_url":"https://api.github.com/users/RytoEX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RytoEX/subscriptions","organizations_url":"https://api.github.com/users/RytoEX/orgs","repos_url":"https://api.github.com/users/RytoEX/repos","events_url":"https://api.github.com/users/RytoEX/events{/privacy}","received_events_url":"https://api.github.com/users/RytoEX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-05-27T05:16:35Z","updated_at":"2018-06-04T03:09:25Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/obsproject/obs-studio/pulls/1308","html_url":"https://github.com/obsproject/obs-studio/pull/1308","diff_url":"https://github.com/obsproject/obs-studio/pull/1308.diff","patch_url":"https://github.com/obsproject/obs-studio/pull/1308.patch"},"body":"This commit fixes an issue where videos created with OBS will appear as having 1000 FPS in some media players (and FFmpeg as of the current Windows nightly).  Credit to @OsirisNL for pointing out the fix and where to apply it.\r\n\r\nI did question whether remuxed videos should also apply this setting.  I briefly investigated this, and it seems that for 60 FPS videos, remuxing calculates a new avg_frame_rate that is within 60±0.01.  I'm not sure if this is preferable to specifying the avg_frame_rate (if the data is available), and I figure that could be left to a separate PR for later if needed.\r\n\r\nI've built and tested this on Windows 10 64-bit.  As always, feedback, reviews, or more testing are welcomed."},"comment":{"url":"https://api.github.com/repos/obsproject/obs-studio/issues/comments/394222961","html_url":"https://github.com/obsproject/obs-studio/pull/1308#issuecomment-394222961","issue_url":"https://api.github.com/repos/obsproject/obs-studio/issues/1308","id":394222961,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDIyMjk2MQ==","user":{"login":"RytoEX","id":624931,"node_id":"MDQ6VXNlcjYyNDkzMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/624931?v=4","gravatar_id":"","url":"https://api.github.com/users/RytoEX","html_url":"https://github.com/RytoEX","followers_url":"https://api.github.com/users/RytoEX/followers","following_url":"https://api.github.com/users/RytoEX/following{/other_user}","gists_url":"https://api.github.com/users/RytoEX/gists{/gist_id}","starred_url":"https://api.github.com/users/RytoEX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RytoEX/subscriptions","organizations_url":"https://api.github.com/users/RytoEX/orgs","repos_url":"https://api.github.com/users/RytoEX/repos","events_url":"https://api.github.com/users/RytoEX/events{/privacy}","received_events_url":"https://api.github.com/users/RytoEX/received_events","type":"User","site_admin":false},"created_at":"2018-06-04T03:09:25Z","updated_at":"2018-06-04T03:09:25Z","author_association":"CONTRIBUTOR","body":"Because `context->time_base;` at that point _is_ the inverse of the user selected FPS, as [I pointed out earlier](https://github.com/obsproject/obs-studio/pull/1308#issuecomment-394105726):\r\n> So in [plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c#L315](https://github.com/obsproject/obs-studio/blob/bbac3280c199680f38842ca803133615501d673d/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c#L315), OBS writes the user-specified FPS (inverted) into time_base and copies that into the video stream's time_base:\r\n\r\n\r\nIn MP4 containers, that is not overwritten (as far as I'm aware).  In MKV, it _is_ overwritten by `avformat_write_header`, which the documentation says will happen.  For this patch, I'm using the time_base _before_ FFmpeg overwrites it.  That's why it has the value we need _at that time_.  I didn't say that time_base is completely unrelated to FPS, I said they were related but different.  From the FFmpeg example file \"[muxinc.c#L154](https://ffmpeg.org/doxygen/4.0/muxing_8c_source.html#l00154)\":\r\n```\r\n/* timebase: This is the fundamental unit of time (in seconds) in terms\r\n * of which frame timestamps are represented. For fixed-fps content,\r\n * timebase should be 1/framerate and timestamp increments should be\r\n * identical to 1. */\r\nost->st->time_base = (AVRational){ 1, STREAM_FRAME_RATE };\r\n```"}}
{"actor":{"display_login":"RytoEX"}}