Code Monkey home page Code Monkey logo

joy4's Introduction

PLEASE USE joy5 INSTEAD

joy5

  • High performance Copy-on-write gop cache code
  • Better av.Packet design code

JOY4

Golang audio/video library and streaming server

JOY4 is powerful library written in golang, well-designed interface makes a few lines of code can do a lot of things such as reading, writing, transcoding among variety media formats, or setting up high-performance live streaming server.

Features

Well-designed and easy-to-use interfaces:

Support container formats:

  • MP4
  • MPEG-TS
  • FLV
  • AAC (ADTS)

RTSP Client

  • High level camera bug tolerance
  • Support STAP-A

RTMP Client

  • Support publishing to nginx-rtmp-server
  • Support playing

RTMP / HTTP-FLV Server

  • Support publishing clients: OBS / ffmpeg / Flash Player (>8)
  • Support playing clients: Flash Player 11 / VLC / ffplay / mpv
  • High performance

Publisher-subscriber packet buffer queue (doc)

  • Customize publisher buffer time and subscriber read position

  • Multiple channels live streaming (example)

Packet filters (doc)

  • Wait first keyframe
  • Fix timestamp
  • Make A/V sync
  • Customize (example)

FFMPEG Golang-style binding (doc)

  • Audio Encoder / Decoder
  • Video Decoder
  • Audio Resampler

Support codec and container parsers:

  • H264 SPS/PPS/AVCDecoderConfigure parser (doc)
  • AAC ADTSHeader/MPEG4AudioConfig parser (doc)
  • MP4 Atoms parser (doc)
  • FLV AMF0 object parser (doc)

Requirements

Go version >= 1.6

ffmpeg version >= 3.0 (optional)

TODO

HLS / MPEG-DASH Server

ffmpeg.VideoEncoder / ffmpeg.SWScale

License

MIT

joy4's People

Contributors

acls avatar attilaolah avatar bak1an avatar bfulkers avatar cfanfrank avatar davidjfelix avatar deepch avatar ericxtang avatar j0sh avatar nareix avatar netroby avatar samuel avatar szook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joy4's Issues

Wirecast RTMP streaming troubles

Hello, I have an issue when streaming from Wirecast to a simple server using joy4/rtmp (server creates a file using avutil.Create, writes a header based on rtmp.Conn streams, reads from RTMP connection and writes packets to file, on closing of the connection writes trailer).
When encoding in Wirecast is set to 3 - Very fast, or slower, I have a green screen (sometimes) in output file and sound missing.

ffprobe -i output file gives me:

[h264 @ 0x2ceaa20] missing picture in access unit with size 122
[h264 @ 0x2ceaa20] non-existing PPS 1 referenced
[h264 @ 0x2ceaa20] sps_id 32 out of range
[h264 @ 0x2ceaa20] reference count 1 overflow

When using a faster encoding level - everything is fine, no errors with ffprobe.
I checked network connection (by the way it is fast enough not to cause troubles).

When I get RTMP stream from nginx-rtmp server, read it with rtmp.Conn.ReadPacket, put it to a pipe, the read a pipe with ffmpeg and read the ffmpeg output with ts.Demuxer, then write it to file with ts.Muxer, I have the same issues (sound missing and green screen on encoding 3 - Very fast or slower)

When I first get RTMP stream from nginx-rtmp server with ffmpeg, use no encoding (just "copy"), output it to stdout, set ts.Demuxer to read stdout and then use ts.Muxer to write to a file - everything is fine even with slower encoding.

May the problem be in rtmp.Conn component?

panic: flv: h264 seqhdr invalid

启动http_flv_and_rtmp_server 这个例子,执行ffmpeg -re -i movie.flv -c copy -f flv rtmp://localhost/movie,在avutil.CopyPackets(ch.que, conn)处报错:flv: h264 seqhdr invalid 。
请问该如何解决呢?谢谢。

Would be so cool if i can to get some advice how to generate rtmp stream from mp4 files...

Firstly ... Sorry for my English
For more information, you can visit my repo
The main point in my code:
reader.go for reading files and sending av.Packet to channel
writer.go send packets to rtmp server.
On the first file, the server work correctly, but on the next file, the twitch (for example) show a spinner
I thought, this behavior because time in packets of next files is skipped, and I started to change time in packets (reader.go (53- ~ 70)), but this decision is incorrect.
Does somebody have some idea how can I do this?
P.S Also I can`t to work with nginx-rtmp-module. Seems like server close connection.
Nginx docker image

RTSP Client will panic after a long time running

joy4/format/rtsp/client.go

Lines 436 to 443 in bd41a3b

if blocklen, _, ok := self.parseBlockHeader(peek); ok {
left := blocklen+4-len(peek)
block = append(peek, make([]byte, left)...)
if _, err = io.ReadFull(self.brconn, block[len(peek):]); err != nil {
return
}
return
}

After a long time running (13h+),

block = append(peek, make([]byte, left)...)
will throw: panic: runtime error: makeslice: len out of range error.

Dead fork?

I see that no PRs have landed since March. I wanted to open a PR, but if the project is no longer being supported, is there a fork that is?

example太少啊

我想知道如何把一个rtsp流抓出来保存为flv

	file, _ := avutil.Create("projectindex.flv")
	conn, _ := rtsp.Dial("rtsp://admin:[email protected]/h264/ch1/sub/av_stream")

	demuxer := &pktque.FilterDemuxer{Demuxer: conn, Filter: &pktque.Walltime{}}
	//demuxer := &transcode.Demuxer{Demuxer: conn,}
	avutil.CopyFile(file, demuxer)

上面代码我乱猜的,不行啊,开启 rtsp.DebugRtp = true 就看见错误,不开debug就闪退:

rtsp: dollar at 11 12
panic: runtime error: invalid memory address or nil pointer dereference

how can i publish packet to other rtmp servers

hello guys, i want to use this library to receive rtmp data from one resource and publish the packet data to other rtmp servers.
i use code like this:

conn, err = rtmp.Dial(url)
conn.WritePacket(packet)

but i got error connection reset by peer, and i'm sure there is no other connections.
Any information would by helpful

Cgo compile error

examples/audio_decode$ go build

github.com/nareix/joy4/cgo/ffmpeg

could not determine kind of name for C.AV_CODEC_FLAG_GLOBAL_HEADER
could not determine kind of name for C.av_frame_alloc
could not determine kind of name for C.av_packet_unref
could not determine kind of name for C.avresample_get_out_samples

How to fix this? Help!

404 not found for multiple channels example

Sorta new to this, just kinda playing around with this for fun. I can't seem to actually get the http_flv_and_rtmp_server example to work properly. When I try to use ffplay I just get a 404 error because the channel doesn't exist. But I can't seem to figure out why

Some questions about rtmp server channels

I read the example code in example > rtmp_server_channels > main.go , but I am really confused about the meaning of delaygop waitkey framedrop delayskip cachegop ,could U add some explanation about this words ? BTW, Thanks for developing such a wonderful streaming lib ~

Get the one frame from the stream

Hello!

Thank you for awesome library!

I have a trivial question, maybe. I want to write very easy monitoring tool for IP-cameras (above 50 devices). The main criteria of avalability of devices is an ability of getting an image. I mean that I need more than simple check by ICMP or TCP/UDP. In this case I want to fetch (programmly) of the frame and checking that this image is non-empty, e.g. Can I do that using of your library?
I found sources of RTSP-client software but I don't know how fetch the frame.

Failed to start http_flv_and_rtmp_server

This is very good open source library for streaming.
I tried to run as given below but error thrown

/go/src/github.com/nareix/joy4/examples$ go run http_flv_and_rtmp_server/main.go

github.com/nareix/joy4/format/flv

*../format/flv/flv.go:416: self.bufr.Discard undefined (type bufio.Reader has no field or method Discard)

Could you please help me out on this issue.

h264 to mp4

I'm sorry for simply posting an issue instead of looking more deeply into the library.

But basically I have a server that is receiving a RAW h264 stream from a raspberry. I'm unable to send the h264 stream directly to a webpage, form what I've read it is much easier to stream it in MP4.

So my question is: Can I use this library to encapsulate my raw h264 stream in MP4 on the fly?

No RTSP client example file

Can you please provide some example file that reads RTSP video and then write the data to some other file?Currently there is no example file relating to RTSP.

RTSP digest authentication not working

It may be specific to the cameras I'm using, but RTSP digest authentication doesn't work unless I comment out this line with basic auth:

fmt.Sprintf(`Authorization: Basic %s`, base64.StdEncoding.EncodeToString([]byte(username+":"+password))),

Maybe instead of appending to headers on line 360 it should assign.

Feature request: possibility to demux UDP MPEG-TS packets

I'm trying to demux MPEG-TS over UDP.

Code is something like that:

addr, err := net.ResolveUDPAddr("udp", "239.1.2.3:1234")
if err != nil {
	log.Fatalln(err)
}

conn, err := net.ListenMulticastUDP("udp", nil, addr)
if err != nil {
	log.Fatalln(err)
}

demux := ts.NewDemuxer(conn)
streams, err := demux.Streams()
if err != nil {
	fmt.Printf("error getting streams: %s\n", err)
	os.Exit(1)
}

It doesn't seem to work correctly.
I've looked through the formats/ts and formats/ts/tsio packages: the clue is, that TSReadPacket wants to have the pure sequence of MPEG-TS packets in the stream.

But when you join multicast stream, you never know which part of it you have started to receive. I mean, you can join in the middle of the packet. In this case, TS parser should read the stream until it encounters a valid beginning of the new MPEG-TS packet.

I could try to implement it by myself, but some piece of advice from the author how to do it properly will be really appreciated.

RTMP Error: h264 seqhdr invalid

Using ffmpeg 3.3, ffmpeg -f avfoundation -framerate 30 -i "0:0" -video_size vga -f flv "rtmp://localhost:1935/stream/live"

Got error: flv: h264 seqhdr invalid. This happens during RTMP handshake.

HLS support

Hi!

First of all, Great work! awesome!

I'm currently just starting with joy4 but loving it this far. But there is this thing:

Is there any estimates on HLS support? Maybe beta to test out?

It is very needed.

publish to yotube

publish to yotube not working , but when i copy rtmp stream to other service all fine. It says remote host closed connection

avutil.CopyFile

If the function avutil.CopyFile is an analog of a io.Copy, then it should return nil if all or and not EOF

fMp4

Wondering if you could point me in the right direction. If I have a channel of packets (MPEG-TS, AAC) how do I mux that into a fMp4 stream suitable for MSE.

Thanks for open sourcing this library. Looks much easier to use than goav for gmf

forward input stream to multiple servers(push )

Hi again!, could you please point out what i'm doing wrong?

package main

import (
    "log"
    "strings"
    "sync"
    "time"

    "github.com/nareix/joy4/av/avutil"
    "github.com/nareix/joy4/av/pktque"
    "github.com/nareix/joy4/av/pubsub"
    "github.com/nareix/joy4/format"
    "github.com/nareix/joy4/format/rtmp"
)

func init() {
    format.RegisterAll()
}

var sm = map[string][]string{
    "azorestv": []string{"rtmp://opinion.azorestv.com:1936/proxy/one", "rtmp://opinion.azorestv.com:1936/proxy/two"},
}

func main() {
    proxyServer()
}

func proxyServer() {
    server := &rtmp.Server{}

    server.HandlePublish = func(conn *rtmp.Conn) {

        segs := strings.Split(conn.URL.Path, "/")
        key := segs[2]
        streamMap, ok := sm[key]
        if !ok {
            log.Println("invalid key")
            return
        }

        que := &pubsub.Queue{}
        que.Close()

        streams, err := conn.Streams()
        if err != nil {
            log.Println(err)
            return
        }

        que = pubsub.NewQueue(streams)
        que.SetMaxDuration(time.Second * 10)

        go func() {
            err := avutil.CopyPackets(que, conn)
            if err != nil {
                log.Println(err)
            }
        }()

        wait := &sync.WaitGroup{}

        for i := range streamMap {
            go func() {
                err := pushStream(que, streamMap[i], wait)
                if err != nil {
                    log.Println(err)
                }

            }()
        }
        wait.Wait()

    }

    server.ListenAndServe()

}

func pushStream(sub *pubsub.Queue, dsturl string, wait *sync.WaitGroup) error {

    defer wait.Done()
    wait.Add(1)

    origin := sub.Latest()
    filters := pktque.Filters{}

    filters = append(filters, &pktque.FixTime{StartFromZero: true, MakeIncrement: true})
    demuxer := &pktque.FilterDemuxer{
        Filter:  filters,
        Demuxer: origin,
    }

    dst, err := rtmp.Dial(dsturl)
    if err != nil {
        return err
    }
    defer dst.Close()

    return avutil.CopyFile(dst, demuxer)
}

thanks again!

example error

root@ubuntu-HP-ProDesk-680-G2-MT:/usr/local/lib# ffmpeg
ffmpeg version 3.1.11 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --prefix=/usr/local --enable-shared
libavutil 55. 28.100 / 55. 78.100
libavcodec 57. 48.101 / 57.107.100
libavformat 57. 41.100 / 57. 83.100
libavdevice 57. 0.101 / 57. 10.100
libavfilter 6. 47.100 / 6.107.100
libswscale 4. 1.100 / 4. 8.100
libswresample 2. 1.100 / 2. 9.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

root@ubuntu-HP-ProDesk-680-G2-MT:~/go/src/github.com/nareix/joy4/examples/audio_decode# go run main.go
/# github.com/nareix/joy4/cgo/ffmpeg
../../cgo/ffmpeg/audio.go: In function ‘wrap_avcodec_decode_audio4’:
../../cgo/ffmpeg/audio.go:7:2: warning: ‘avcodec_decode_audio4’ is deprecated [-Wdeprecated-declarations]
return avcodec_decode_audio4(ctx, frame, got, &pkt);
^
In file included from /usr/local/include/libavformat/avformat.h:317:0,
from ../../cgo/ffmpeg/ffmpeg.h:2,
from ../../cgo/ffmpeg/audio.go:4:
/usr/local/include/libavcodec/avcodec.h:4714:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
../../cgo/ffmpeg/audio.go: In function ‘_cgo_77bb8e1dcb21_Cfunc_avcodec_encode_audio2’:
../../cgo/ffmpeg/audio.go:124:2: warning: ‘avcodec_encode_audio2’ is deprecated [-Wdeprecated-declarations]
}
^
In file included from /usr/local/include/libavformat/avformat.h:317:0,
from ../../cgo/ffmpeg/ffmpeg.h:2,
from ../../cgo/ffmpeg/audio.go:4:
/usr/local/include/libavcodec/avcodec.h:5232:5: note: declared here
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
^
/# github.com/nareix/joy4/cgo/ffmpeg
../../cgo/ffmpeg/video.go: In function ‘wrap_avcodec_decode_video2’:
../../cgo/ffmpeg/video.go:7:2: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
return avcodec_decode_video2(ctx, frame, got, &pkt);
^
In file included from /usr/local/include/libavformat/avformat.h:317:0,
from ../../cgo/ffmpeg/ffmpeg.h:2,
from ../../cgo/ffmpeg/video.go:4:
/usr/local/include/libavcodec/avcodec.h:4763:5: note: declared here
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
^
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x6666a0, 0xc82000a0c0)
/usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
main.main()
/home/ubuntu/go/src/github.com/nareix/joy4/examples/audio_decode/main.go:30 +0x3ae
exit status 2

Unable to proxy rtmp (EOF)

test server rtmp://opinion.azorestv.com/clients/57040dd71756e561cece4900

rtmp: handshakeClient: server version 3 0 1 1
rtmp: > connect('clients') host=opinion.azorestv.com:1935
rtmp: write chunk msgdatalen=214 msgsid=0
00000000 02 00 07 63 6f 6e 6e 65 63 74 00 3f f0 00 00 00 |...connect.?....|
00000010 00 00 00 03 00 04 66 70 61 64 01 00 00 0c 63 61 |......fpad....ca|
00000020 70 61 62 69 6c 69 74 69 65 73 00 40 2e 00 00 00 |pabilities.@....|
00000030 00 00 00 00 0b 61 75 64 69 6f 43 6f 64 65 63 73 |.....audioCodecs|
00000040 00 40 af ce 00 00 00 00 00 00 0b 76 69 64 65 6f |[email protected]|
00000050 43 6f 64 65 63 73 00 40 6f 80 00 00 00 00 00 00 |Codecs.@o.......|
00000060 0d 76 69 64 65 6f 46 75 6e 63 74 69 6f 6e 00 3f |.videoFunction.?|
00000070 f0 00 00 00 00 00 00 00 03 61 70 70 02 00 07 63 |.........app...c|
00000080 6c 69 65 6e 74 73 00 08 66 6c 61 73 68 56 65 72 |lients..flashVer|
00000090 02 00 0e 4d 41 43 20 32 32 2c 30 2c 30 2c 31 39 |...MAC 22,0,0,19|
000000a0 32 00 05 74 63 55 72 6c 02 00 28 72 74 6d 70 3a |2..tcUrl..(rtmp:|
000000b0 2f 2f 6f 70 69 6e 69 6f 6e 2e 61 7a 6f 72 65 73 |//opinion.azores|
000000c0 74 76 2e 63 6f 6d 3a 31 39 33 35 2f 63 6c 69 65 |tv.com:1935/clie|
000000d0 6e 74 73 00 00 09 |nts...|
rtmp: write chunk msgdatalen=4 msgsid=0
00000000 00 4c 4b 40 |.LK@|
rtmp: write chunk msgdatalen=5 msgsid=0
00000000 00 4c 4b 40 02 |.LK@.|
rtmp: write chunk msgdatalen=4 msgsid=0
00000000 08 00 00 00 |....|
rtmp: chunk msgsid=0 msgtypeid=5 msghdrtype=0 len=4 left=0
rtmp: chunk data
00000000 00 26 25 a0 |.&%.|
rtmp: write chunk msgdatalen=4 msgsid=0
00000000 00 26 25 a0 |.&%.|
rtmp: chunk msgsid=0 msgtypeid=6 msghdrtype=0 len=5 left=0
rtmp: chunk data
00000000 00 26 25 a0 02 |.&%..|
rtmp: chunk msgsid=0 msgtypeid=4 msghdrtype=0 len=6 left=0
rtmp: chunk data
00000000 00 00 00 00 00 00 |......|
rtmp: chunk msgsid=0 msgtypeid=1 msghdrtype=0 len=4 left=0
rtmp: chunk data
00000000 00 00 10 00 |....|
rtmp: chunk msgsid=0 msgtypeid=20 msghdrtype=0 len=261 left=0
rtmp: chunk data
00000000 02 00 07 5f 72 65 73 75 6c 74 00 3f f0 00 00 00 |..._result.?....|
00000010 00 00 00 03 00 06 66 6d 73 56 65 72 02 00 0e 46 |......fmsVer...F|
00000020 4d 53 2f 33 2c 35 2c 37 2c 37 30 30 39 00 0c 63 |MS/3,5,7,7009..c|
00000030 61 70 61 62 69 6c 69 74 69 65 73 00 40 3f 00 00 |apabilities.@?..|
00000040 00 00 00 00 00 04 6d 6f 64 65 00 3f f0 00 00 00 |......mode.?....|
00000050 00 00 00 00 00 09 03 00 05 6c 65 76 65 6c 02 00 |.........level..|
00000060 06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 1d |.status..code...|
00000070 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f |NetConnection.Co|
00000080 6e 6e 65 63 74 2e 53 75 63 63 65 73 73 00 0b 64 |nnect.Success..d|
00000090 65 73 63 72 69 70 74 69 6f 6e 02 00 15 43 6f 6e |escription...Con|
000000a0 6e 65 63 74 69 6f 6e 20 73 75 63 63 65 65 64 65 |nection succeede|
000000b0 64 2e 00 04 64 61 74 61 08 00 00 00 00 00 07 76 |d...data.......v|
000000c0 65 72 73 69 6f 6e 02 00 0a 33 2c 35 2c 37 2c 37 |ersion...3,5,7,7|
000000d0 30 30 39 00 00 09 00 08 63 6c 69 65 6e 74 69 64 |009.....clientid|
000000e0 00 41 d7 75 11 16 c0 00 00 00 0e 6f 62 6a 65 63 |.A.u.......objec|
000000f0 74 45 6e 63 6f 64 69 6e 67 00 00 00 00 00 00 00 |tEncoding.......|
00000100 00 00 00 00 09 |.....|
[]
rtmp: < _result() of connect
rtmp: > createStream()
rtmp: write chunk msgdatalen=25 msgsid=0
00000000 02 00 0c 63 72 65 61 74 65 53 74 72 65 61 6d 00 |...createStream.|
00000010 40 00 00 00 00 00 00 00 05 |@........|
rtmp: write chunk msgdatalen=10 msgsid=0
00000000 00 03 00 00 00 00 00 00 00 64 |.........d|
rtmp: chunk msgsid=0 msgtypeid=20 msghdrtype=0 len=29 left=0
rtmp: chunk data
00000000 02 00 07 5f 72 65 73 75 6c 74 00 40 00 00 00 00 |..._result.@....|
00000010 00 00 00 05 00 3f f0 00 00 00 00 00 00 |.....?.......|
rtmp: > play('57040dd71756e561cece4900')
rtmp: write chunk msgdatalen=44 msgsid=1
00000000 02 00 04 70 6c 61 79 00 00 00 00 00 00 00 00 00 |...play.........|
00000010 05 02 00 18 35 37 30 34 30 64 64 37 31 37 35 36 |....57040dd71756|
00000020 65 35 36 31 63 65 63 65 34 39 30 30 |e561cece4900|
rtmp: chunk msgsid=0 msgtypeid=4 msghdrtype=0 len=6 left=0
rtmp: chunk data
00000000 00 00 00 00 00 01 |......|
rtmp: chunk msgsid=1 msgtypeid=20 msghdrtype=0 len=136 left=0
rtmp: chunk data
00000000 02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 |...onStatus.....|
00000010 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 06 |........level...|
00000020 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e |status..code...N|
00000030 65 74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 52 65 |etStream.Play.Re|
00000040 73 65 74 00 0b 64 65 73 63 72 69 70 74 69 6f 6e |set..description|
00000050 02 00 1f 50 6c 61 79 69 6e 67 20 61 6e 64 20 72 |...Playing and r|
00000060 65 73 65 74 74 69 6e 67 20 66 61 6b 65 6c 69 76 |esetting fakeliv|
00000070 65 2e 00 08 63 6c 69 65 6e 74 69 64 00 41 d7 75 |e...clientid.A.u|
00000080 11 16 c0 00 00 00 00 09 |........|
rtmp: chunk msgsid=1 msgtypeid=20 msghdrtype=0 len=172 left=0
rtmp: chunk data
00000000 02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 |...onStatus.....|
00000010 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 06 |........level...|
00000020 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e |status..code...N|
00000030 65 74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 53 74 |etStream.Play.St|
00000040 61 72 74 00 0b 64 65 73 63 72 69 70 74 69 6f 6e |art..description|
00000050 02 00 19 53 74 61 72 74 65 64 20 70 6c 61 79 69 |...Started playi|
00000060 6e 67 20 66 61 6b 65 6c 69 76 65 2e 00 08 63 6c |ng fakelive...cl|
00000070 69 65 6e 74 69 64 00 41 d7 75 11 16 c0 00 00 00 |ientid.A.u......|
00000080 0a 69 73 46 61 73 74 50 6c 61 79 01 00 00 0e 74 |.isFastPlay....t|
00000090 69 6d 65 63 6f 64 65 4f 66 66 73 65 74 02 00 09 |imecodeOffset...|
000000a0 35 37 38 30 33 38 38 32 4c 00 00 09 |57803882L...|
rtmp: chunk msgsid=1 msgtypeid=18 msghdrtype=1 len=24 left=0
rtmp: chunk data
00000000 02 00 11 7c 52 74 6d 70 53 61 6d 70 6c 65 41 63 |...|RtmpSampleAc|
00000010 63 65 73 73 01 00 01 00 |cess....|
rtmp: chunk msgsid=1 msgtypeid=18 msghdrtype=0 len=44 left=0
rtmp: chunk data
00000000 02 00 08 6f 6e 53 74 61 74 75 73 03 00 04 63 6f |...onStatus...co|
00000010 64 65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e 44 |de...NetStream.D|
00000020 61 74 61 2e 53 74 61 72 74 00 00 09 |ata.Start...|
rtmp: chunk msgsid=0 msgtypeid=4 msghdrtype=0 len=6 left=0
rtmp: chunk data
00000000 00 20 00 00 00 01 |. ....|
rtmp: chunk msgsid=1 msgtypeid=18 msghdrtype=1 len=581 left=0
rtmp: chunk data
00000000 02 00 0a 6f 6e 4d 65 74 61 44 61 74 61 03 00 09 |...onMetaData...|
00000010 74 72 61 63 6b 69 6e 66 6f 0a 00 00 00 02 03 00 |trackinfo.......|
00000020 08 6c 61 6e 67 75 61 67 65 02 00 03 75 6e 64 00 |.language...und.|
00000030 09 74 69 6d 65 73 63 61 6c 65 00 40 39 00 00 00 |.timescale.@9...|
00000040 00 00 00 00 06 6c 65 6e 67 74 68 00 40 ca 84 00 |.....length.@...|
00000050 00 00 00 00 00 11 73 61 6d 70 6c 65 64 65 73 63 |......sampledesc|
00000060 72 69 70 74 69 6f 6e 0a 00 00 00 01 03 00 0a 73 |ription........s|
00000070 61 6d 70 6c 65 74 79 70 65 02 00 04 61 76 63 31 |ampletype...avc1|
00000080 00 00 09 00 00 09 03 00 08 6c 61 6e 67 75 61 67 |.........languag|
00000090 65 02 00 03 65 6e 67 00 09 74 69 6d 65 73 63 61 |e...eng..timesca|
000000a0 6c 65 00 40 e5 88 80 00 00 00 00 00 06 6c 65 6e |[email protected]|
000000b0 67 74 68 00 41 76 d6 c0 00 00 00 00 00 11 73 61 |gth.Av........sa|
000000c0 6d 70 6c 65 64 65 73 63 72 69 70 74 69 6f 6e 0a |mpledescription.|
000000d0 00 00 00 01 03 00 0a 73 61 6d 70 6c 65 74 79 70 |.......sampletyp|
000000e0 65 02 00 04 6d 70 34 61 00 00 09 00 00 09 00 0d |e...mp4a........|
000000f0 61 75 64 69 6f 63 68 61 6e 6e 65 6c 73 00 40 00 |audiochannels.@.|
00000100 00 00 00 00 00 00 00 0f 61 75 64 69 6f 73 61 6d |........audiosam|
00000110 70 6c 65 72 61 74 65 00 40 e5 88 80 00 00 00 00 |plerate.@.......|
00000120 00 0e 76 69 64 65 6f 66 72 61 6d 65 72 61 74 65 |..videoframerate|
00000130 00 40 39 00 00 00 00 00 00 00 06 61 61 63 61 6f |.@9........aacao|
00000140 74 00 40 00 00 00 00 00 00 00 00 08 61 76 63 6c |[email protected]|
00000150 65 76 65 6c 00 40 3e 00 00 00 00 00 00 00 0a 61 |evel.@>........a|
00000160 76 63 70 72 6f 66 69 6c 65 00 40 50 80 00 00 00 |vcprofile.@p....|
00000170 00 00 00 0c 61 75 64 69 6f 63 6f 64 65 63 69 64 |....audiocodecid|
00000180 02 00 04 6d 70 34 61 00 0c 76 69 64 65 6f 63 6f |...mp4a..videoco|
00000190 64 65 63 69 64 02 00 04 61 76 63 31 00 05 77 69 |decid...avc1..wi|
000001a0 64 74 68 00 40 84 00 00 00 00 00 00 00 06 68 65 |[email protected]|
000001b0 69 67 68 74 00 40 76 80 00 00 00 00 00 00 0a 66 |ight.@v........f|
000001c0 72 61 6d 65 57 69 64 74 68 00 40 84 00 00 00 00 |rameWidth.@.....|
000001d0 00 00 00 0b 66 72 61 6d 65 48 65 69 67 68 74 00 |....frameHeight.|
000001e0 40 76 80 00 00 00 00 00 00 0c 64 69 73 70 6c 61 |@v........displa|
000001f0 79 57 69 64 74 68 00 40 84 00 00 00 00 00 00 00 |yWidth.@........|
00000200 0d 64 69 73 70 6c 61 79 48 65 69 67 68 74 00 40 |.displayHeight.@|
00000210 76 80 00 00 00 00 00 00 09 66 72 61 6d 65 72 61 |v........framera|
00000220 74 65 00 40 39 00 00 00 00 00 00 00 0c 6d 6f 6f |te.@9........moo|
00000230 76 70 6f 73 69 74 69 6f 6e 00 40 40 00 00 00 00 |vposition.@@....|
00000240 00 00 00 00 09 |.....|
rtmp: chunk msgsid=1 msgtypeid=9 msghdrtype=0 len=45 left=0
rtmp: chunk data
00000000 17 00 00 00 00 01 42 c0 1e ff e1 00 19 67 42 c0 |......B......gB.|
00000010 1e da 02 80 bf e5 c0 44 00 00 03 00 04 00 00 03 |.......D........|
00000020 00 c8 3c 58 ba 80 01 00 04 68 ce 3c 80 |..<X.....h.<.|
rtmp: chunk msgsid=1 msgtypeid=9 msghdrtype=1 len=2 left=0
rtmp: chunk data
00000000 57 00 |W.|

关于视频转码问题

我在运用该项目进行视频转码的时候,发现只有音频编码解码,而缺少视频编码解码,不知道是否我看没找到,还是暂时不支持?(感谢该项目)

Using CFLAGS to change library path

I am trying to build joy4 with custom ffmpeg library files.
I've added:
#cgo CFLAGS: -I/path/to/include/
in ffmpeg.go file and I am getting a file not found error:
./ffmpeg.h:1:10: fatal error: 'libavutil/samplefmt.h' file not found

The files are all there - these are ffmpeg pre-build library for ARM processors.
What am I missing?

ffmpeg bindings error

# bitbucket.org/andboson/cams-back/vendor/github.com/nareix/joy4/cgo/ffmpeg vendor/github.com/nareix/joy4/cgo/ffmpeg/audio.go:298: cannot use C.int64_t(self.Bitrate) (type C.int64_t) as type C.int in assignment

when i run

/github.com/nareix/joy4/examples/transcode/main.go

Ubuntu 16.04 x64

TS file generated contains invalid aac sample rate

I am generating TS files, and the aac track sample rate is not stored correctly. The sample rate is set to 48000, 1 channel, AOT_AAC_LC.

	mPEG4AudioConfig := aacparser.MPEG4AudioConfig{
		SampleRate:      48000,
		SampleRateIndex: 0, // if 0 will be calculated
		ChannelConfig: 0,                  // if 0 it will be calculated
		ChannelLayout: av.CH_FRONT_CENTER,
		ObjectType: aacparser.AOT_AAC_LC,
	}
ffprobe version 4.0 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --prefix=/home/alexj/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/alexj/ffmpeg_build/include --extra-ldflags=-L/home/alexj/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/alexj/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[aac @ 0x4b2fc40] Multiple frames in a packet.
[aac @ 0x4b2fc40] channel element 2.6 is not allocated
    Last message repeated 166 times
[mpegts @ 0x4b29ec0] decoding for stream 1 failed
[mpegts @ 0x4b29ec0] Could not find codec parameters for stream 1 (Audio: aac (LC) ([15][0][0][0] / 0x000F), mono, fltp, 52 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'tmp.ts':
  Duration: 00:00:03.57, start: 56548.874933, bitrate: 266 kb/s
  Program 1 
    Stream #0:0[0x100]: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(progressive), 360x640, 90k tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), mono, fltp, 52 kb/s

Development stopped ?

Great system. I am using this and likely extending.
Is this dead or looking for maintainer ?

Documentation of running & building examples

Looks like there is not much documentation regarding running the examples or what they are designed to do.

I think I've worked out the http rtmp server example (testing now), but it would be a lot easier if there were guides for each example as well as a build script & documentation for the examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.