r_frame_rate is 2x avg_frame_rate after transcoding 24fps input into a 30fps output
- Dominant language
- Go
- Stars
- 283
- Forks
- 72
- Avg merge
- 27m
- Merged PRs (30d)
- 1
Description
I transcoded a 24fps input into a 30fps output.
The RTMP stream was created using this command:
```bash
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=24 -f lavfi -i sine -vf drawtext="text='%{localtime\:%X}':fontsize=20:fontcolor=white:x=7:y=7" -pix_fmt yuv420p -vcodec libx264 -vb 2000k -preset ultrafast -acodec aac -f flv
```
ffprobe output:
```bash
ffprobe 28856_35273.ts
ffprobe version 4.2.2 Copyright (c) 2007-2019 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mpegts, from '28856_35273.ts':
Duration: 00:00:06.44, start: 28.856000, bitrate: 299 kb/s
Program 1
Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 66 kb/s
Stream #0:1[0x102]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 30 fps, 60 tbr, 90k tbn, 60 tbc
```
So, the fps is correctly reported as 30. But, the tbr, which I believe is ffprobe's best guess for the fps, is 60.
ffprobe fps related metadata output:
```bash
ffprobe -loglevel warning -select_streams v -show_streams 28856_35273.ts | grep frame
has_b_frames=0
r_frame_rate=60/1
avg_frame_rate=30/1
nb_frames=N/A
nb_read_frames=N/A
```
The avg_frame_rate is correctly reported as 30, but the r_frame_rate is 60.
This behavior seems to be different now compared to before #229 was merged.
Before #229 was merged, I believe that when transcoding the same input, the r_frame_rate and avg_frame_rate were the same.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the reported stream with the supplied ffmpeg command and inspect its frame-rate metadata using the supplied ffprobe commands. Compare the current behavior with the change introduced by #229; done means determining why r_frame_rate is 60/1 while avg_frame_rate is 30/1 and correcting the regression if appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100