Skip to content

Transcoding h264_rkmpp -> h264_rkmpp results in jerky motion (and errors about duplicate frames) #185

@oryjkov

Description

@oryjkov

Transcoding an h264 video 50fps 1080p from a Canon camera on an rk3588 board.

The resulting videos has jerky motion, it feels like some frames are getting reordered, perhaps around 2 times per second. It is really nauseating to watch this.

The problem does not happen when using a sw decoder (-c:v h264).

I also tried h264 and h265 output, no difference.

Command used:

ffmpeg -hide_banner -y  -hwaccel rkmpp     -hwaccel_output_format drm_prime     -i in.mp4     -map_metadata 0     -c:a libopus -b:a 64k     -strict -2    -c:v hevc_rkmpp     -rc_mode 2     -qp_init 22     -tag:v hvc1 out.mp4

The final summary shows:

frame= 1074 fps= 77 q=-0.0 Lsize=   37349kB time=00:00:21.46 bitrate=14257.5kbits/s dup=90 drop=0 speed=1.54x

Note the dup=90. When using the software decoder, there is no dup.

With more verbose logging the following is printed periodically

[hevc_rkmpp @ 0xaaaad1b6d680] Received a packet
[hevc_rkmpp @ 0xaaaad1b6d680] Wrote 4177920 bytes to encoder
[hevc_rkmpp @ 0xaaaad1b6d680] Received a packet
[hevc_rkmpp @ 0xaaaad1b6d680] Wrote 4177920 bytes to encoder
[hevc_rkmpp @ 0xaaaad1b6d680] Received a packet
[vost#0:0/hevc_rkmpp @ 0xaaaad1b6d1d0] *** 2 dup!

Would really appreciate any help. Running sw decoder is not really an option due to power constraints.
Thanks!

ffmpeg built like this:

# Build and install MPP
WORKDIR /tmp/mpp
RUN git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git rkmpp
WORKDIR /tmp/mpp/build
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF ../rkmpp
RUN make -j$(nproc) install

# Build and install RGA
WORKDIR /tmp/rkrga
RUN git clone -b jellyfin-rga --depth=1 https://github.com/nyanmisaka/rk-mirrors.git src
WORKDIR /tmp/rkrga/build
RUN meson setup ../src --prefix=/usr/local --libdir=lib --buildtype=release --default-library=shared -Dcpp_args=-fpermissive -Dlibdrm=false -Dlibrga_demo=false
RUN ninja install

# Build and install FFmpeg
WORKDIR /tmp/ffmpeg
RUN git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git src
WORKDIR /tmp/ffmpeg/build
RUN ../src/configure --prefix=/usr/local --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-libopus
RUN make -j$(nproc) install

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamUpstream driver or runtime issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions