livepeer / go-livepeer

Official Go implementation of the Livepeer protocol
http://livepeer.org
MIT License
539 stars 169 forks source link

GPU based passthrough fps transcoding not respecting input bitrate setting #1647

Open ericxtang opened 3 years ago

ericxtang commented 3 years ago

Describe the bug The GPU based passthrough fps transcoding seems to not respect the input bitrate setting.

To Reproduce Steps to reproduce the behavior:

  1. Create a new stream with passthrough fps with the livepeer.com API, with one of the renditions being 720p with fps: 0, at 2000000 bits.
  2. Post the example 60fps video segment to the HTTP push API
  3. Use munpack to split the result
  4. The resulting segment has a much higher bitrate than 2000000 bits.

Expected behavior Resulting 720p segment should have a bitrate close to 2000000

1_0.ts.gz

jailuthra commented 3 years ago

Thanks for creating the issue! @ericxtang

Edited the issue a bit to replace /s/720p30fps/720p-passthru i.e. fps: 0

jailuthra commented 3 years ago

Transcoding the segment mention in issue with the following profile using both GPU and CPU based local livepeer O/T node

{"name":"720p","bitrate":2000000,"fps":0,"width":1280,"height":720}
$ ffprobe 720p_cpu.ts
Input #0, mpegts, from '720p_cpu.ts':
  Duration: 00:00:10.83, start: 3162.943000, bitrate: 2332 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, 59.94 fps, 59.94 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 120 kb/s

$ ffprobe 720p_gpu.ts
Input #0, mpegts, from '720p_gpu.ts':
  Duration: 00:00:10.83, start: 3162.943000, bitrate: 4353 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 148 kb/s

The GPU output is bigger in size, reports higher bitrate and wrong FPS (29.97) in metadata (despite having correct amount of frames)

Attaching the transcoded outputs - cpu_gpu.tar.gz