Skip to content

Can't get good quality with gstreamer due to fragmenting issue #557

@skirsten

Description

@skirsten

So I don't know what I am doing wrong. But the visual and audio quality is just much worse than if I stream the same pipeline to a file and play it back.

via MoQ:

gst-launch-1.0 -v -e filesrc location=sample.mp4 ! qtdemux name=demux \
  demux.video_0 ! decodebin ! queue ! identity sync=true ! nvh264enc bitrate=6000 gop-size=120 rc-mode=cbr-ld-hq zerolatency=true ! h264parse ! queue ! identity sync=true check-imperfect-timestamp=true check-imperfect-offset=true ! isofmp4mux name=mux chunk-duration=1 fragment-duration=1 ! hangsink url="***" broadcast="***" \
  demux.audio_0 ! decodebin ! queue ! identity sync=true ! voaacenc bitrate=160000 ! aacparse ! queue ! identity sync=true check-imperfect-timestamp=true check-imperfect-offset=true ! mux.
Image

to file:

gst-launch-1.0 -v -e filesrc location=sample.mp4 ! qtdemux name=demux \
  demux.video_0 ! decodebin ! queue ! identity sync=true ! nvh264enc bitrate=6000 gop-size=120 rc-mode=cbr-ld-hq zerolatency=true ! h264parse ! queue ! identity sync=true check-imperfect-timestamp=true check-imperfect-offset=true ! mp4mux name=mux ! filesink location=output.mp4 \
  demux.audio_0 ! decodebin ! queue ! identity sync=true ! voaacenc bitrate=160000 ! aacparse ! queue ! identity sync=true check-imperfect-timestamp=true check-imperfect-offset=true ! mux.
Image

Also looking at the audio waveform, it looks like its outputting mono 😕.

Edit:

So I inspected the output file output.fmp4 (using isofmp4mux name=mux chunk-duration=1 fragment-duration=1 ! filesink location=output.fmp4) and it has way too many keyframes (which would explain the worse quality). But if I use chunk-duration=2000000000 fragment-duration=2000000000 which should mean 2 second chunks (matching the 60fps and 120 GoP) I am getting this error:

thread '' panicked at hang-gst/src/sink/imp.rs:146:38:
failed to parse: Mp4(DuplicateBox(trun))

When I pipe it to a file instead, the output looks much better (and the keyframes make sense).

What is this "TRUN" box and how can I work around it or do you have any idea what to do here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions