gpac / gpac

GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
https://gpac.io
GNU Lesser General Public License v2.1
2.61k stars 511 forks source link

Weird error messages when using ff* wrappers #2812

Closed rbouqueau closed 4 days ago

rbouqueau commented 1 month ago

For example I can start and playback an srt:// stream, but these errors are confusion:

$ gpac avgen c=avc c=aac -o srt://127.0.0.1:9000::ffmt=mpegts:mode=listener -graph
[FFMux] Fail to write packet to srt://127.0.0.1:9000: error Input/output error - aborting <= HERE
session last process error I/O Error                                                      <= HERE
Unknown argument ":9000" set but not used by any filter - no matching argument found      <= HERE

Filters connected:
 "avgen" (js=/home/rbouqueau/works/gpac/gpac/share/scripts/jsf/avgen/init.js) (idx=1)
-(PID audio) resample (dyn_idx=6)
--(PID audio) ffenc "ffenc:aac" (c=aac) (idx=3)
---(PID audio) ffmx (dst=srt://127.0.0.1:9000::ffmt=mpegts:mode=listener) (idx=4)
-(PID video) ffenc "ffenc:libx264" (c=avc) (idx=2)
--(PID video) rfnalu (dyn_idx=5)
---(PID video) ffmx (dst=srt://127.0.0.1:9000::ffmt=mpegts:mode=listener) (idx=4)
[aac] 2 frames left in the queue on closin

and (playback):

$ gpac -play srt://127.0.0.1:9000
Type 'h' in window for command list
Filter ffdec:9000 option set but not use <= HERE
jeanlf commented 1 week ago

You must use a trailing '/' after the port number, otherwise it will be considered as an option , see http://wiki.gpac.io/Filters/filters_general/#generic-declaration

The error from the muxer side is the one forwarded by libavformat upon connection close but there's no way of differentiating from any other IO error, hence the result. Maybe we could just ignore and abort without setting the error ?

rbouqueau commented 1 week ago

I confirm it works with a trailing slash. Note that I had put a double colon ::. This is just confusing, but not sure how to improve this.

The error from the muxer side is the one forwarded by libavformat upon connection close but there's no way of differentiating from any other IO error, hence the result. Maybe we could just ignore and abort without setting the error ?

FFmpeg doesn't display this message (but is it present and they hide it or is it GPAC's code sequence?):

$ ffmpeg -re -i ~/works/fk-encode/data/beepbop.mp4 -c copy -f mpegts srt://127.0.0.1:9000?mode=listenerffmpeg version 6.1-5 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13 (Debian 13.2.0-7)
[...]
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/rbouqueau/works/fk-encode/data/beepbop.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2014-04-16T19:31:37.000000Z
  Duration: 00:00:04.99, start: 0.000000, bitrate: 86 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 16 kb/s (default)
    Metadata:
      creation_time   : 2012-09-12T12:14:57.000000Z
      handler_name    : counter-10mn_aac_16k.aac - Imported with GPAC 0.5.1-DEV-rev4127:4130M
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 320x180, 65 kb/s, 25 fps, 25 tbr, 25k tbn (default)
    Metadata:
      creation_time   : 2012-02-14T00:07:31.000000Z
      handler_name    : counter-10mn_I25_320x180_48kbps_baseline.264:dur=600 - Imported with GPAC 0.4.6-DEV-rev3915
      vendor_id       : [0][0][0][0]
Output #0, mpegts, to 'srt://127.0.0.1:9000?mode=listener':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    encoder         : Lavf60.16.100
  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 320x180, q=2-31, 65 kb/s, 25 fps, 25 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2012-02-14T00:07:31.000000Z
      handler_name    : counter-10mn_I25_320x180_48kbps_baseline.264:dur=600 - Imported with GPAC 0.4.6-DEV-rev3915
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 16 kb/s (default)
    Metadata:
      creation_time   : 2012-09-12T12:14:57.000000Z
      handler_name    : counter-10mn_aac_16k.aac - Imported with GPAC 0.5.1-DEV-rev4127:4130M
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[out#0/mpegts @ 0x5636f0688740] video:40kB audio:10kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 78.372326%
size=      89kB time=00:00:04.96 bitrate= 146.2kbits/s speed=1.11
$
rbouqueau commented 4 days ago

I misunderstood that '::' was not needed (but '/' was). And FFmpeg does also output the errors, so GPAC is good here. Closing.