2 Replies
      Latest reply on Apr 21, 2020 12:47 AM by jonct
      jonct Level 1 Level 1 (0 points)

        I notice that precious few HTTP Live Streaming questions have gotten responses, let alone answers. But I'll be optimistic!

         

        I'd like to try streaming my own live video through the LL-HLS tools (currently prerelease 73), in multiple bitrates.

         

        I succeeded in following directions: I use tsrecompressor to generate "bip-bop" video and pass three compressed variations of that into three instances of mediastreamsegmenter, then out through three instances of ll-hls-origin-example.go. It works as promised, end-to-end.

         

             (Brief aside, for any who may stumble after me: it took me too long to realize that I should improve my knowledge of IP Multicasting and use the prescribed 224.0.0.50 address. I got nowhere trying to simply route familiar UDP unicast between my processes.)

         

        So far, so good. Now I want to supply my own video from an external feed. Not the generated "bip-bop" or any local capture devices.

         

        % tsrecompressor --help
        tsrecompressor: unrecognized option `--help'
        Read input MPEG-2 TS, recompress and write to output. Usage: tsrecompressor [options] where options are:
          -i    | --input-file= : input file path (default is stdin)
        ... etc.

         

        That sounds fantastic — I'd love to feed tsrecompressor through stdin! But in what format? It doesn't say, and my first few dozen guesses came up cold.

         

        The man page for mediastreamsegmenter appears to point the way:

         

             The mediastreamsegmenter only accepts MPEG-2 Transport Streams as defined
             in ISO/IEC 14496-1 as input.  The transport stream must contain H.264
             (MPEG-4, part 10) video and AAC or MPEG audio.  If AAC audio is used, it
             must have ADTS headers.  H.264 video access units must use Access Unit
             Delimiter NALs, and must be in unique PES packets.

         

        Of course, that's mediastreamsegmenter and not tsrecompressor. But it's a start. So this is my best guess at the appropriate ffmpeg output. (Recall that I want to eventually pass a live stream into ffmpeg; for now I'm starting with an m4v file.)

         

        % ffmpeg -re -i infile.m4v \
                -c:v h264_************ \
                -c:a aac_at \
                -f mpegts \
          - | tsrecompressor -h -a \
                -O 224.0.0.50:9121 \
                -L 224.0.0.50:9123 \
                -P 224.0.0.50:9125

         

        This ends abruptly after 9 frames.

         

        av_interleaved_write_frame(): Broken pipe
        Error writing trailer of pipe:: Broken pipe//

         

        My best results are when I change from H.264 to H.265:

         

        % ffmpeg -re -i infile.m4v \
                -c:v hevc_************ \
                -c:a aac_at \
                -f mpegts \
          - | tsrecompressor -h -a \
                -O 224.0.0.50:9121 \
                -L 224.0.0.50:9123 \
                -P 224.0.0.50:9125

         

        Now it doesn't break the pipe. It keeps counting along, frame after frame. The VTEncoderXPCService starts up, and sampling of the tsrecompressor process shows both producer and consumer threads for audio recompression.

         

        But there's no output. There was output for the generated "bip-bop" video. Not for HEVC-TS via stdin. I'm not 100% certain yet but I see no indication of any UDP output from tsrecompressor. The three mediastreamsegmenter processes sit idle.

         

        Am I missing some tag, or something, in the input stream? Do I need to pay more attention to chunk sizes and frame offsets?

         

        Thanks, all, for any insight or experience.

        • Re: Putting the TS into tsrecompressor
          jonct Level 1 Level 1 (0 points)

          I should clarify that the "broken pipe" output was from ffmpeg.

           

          With some interpretation, this appears to be the corresponding output from tsrecompressor on the receiving end of the H.264 pipe:

           

          newTrackCallback mediaType vide track 1
          newTrackCallback mediaType soun track 2
          formatDescriptionOrDecryptorChangedCallback for track 1
          HW video encoder for 2000000
          SW video encoder for 500000
          HW video encoder for 4000000
          encountered failure create vmc (-12903) - exiting
          

           

          Where VTErrors.h identifies error -12903 as kVTInvalidSessionErr.

           

          The same command substituting HEVC produces no such error, but again no output.

          • Re: Putting the TS into tsrecompressor
            jonct Level 1 Level 1 (0 points)
            -c:v h264_************ \  

             

            Well, that's an unexpected substitution. I should check Urban Dictionary for any double entendre regarding a particular "toolbox" for processing "video" as a hardware accelerated codec offered only in macOS builds of ffmpeg.