ffmpeg把mp4推rtsp报错:AAC with no global headers is currently not supported.

在尝试使用ffmpeg将本地TS文件推送到RTSP流服务器时遇到错误:AAC编码器不支持无全局头。解决方案是在命令中添加'-rtp_flags latm'参数,修正后的ffmpeg命令成功将音频和视频流复制到RTSP流中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原始命令是

 .\ffmpeg.exe -re -i D:\素材\1.ts -c:v copy -c:a -copy -f rtsp rtsp://localhost:8554/stream

然后报错

[rtsp @ 000000bc0ddf76b0] AAC with no global headers is currently not supported.
Could not write header for output file #0 (incorrect codec parameters ?): Server returned 400 Bad Request
Error initializing output stream 0:1 --
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)

正确命令

 .\ffmpeg.exe -re -i D:\素材\1.ts -c:v copy -c:a copy -rtpflags latm -f rtsp rtsp://localhost:8554/stream

### Live555 H264 Implementation and Usage in Streaming Media #### Overview of Live555 with H264 Encoding Live555 is a C++ library that facilitates the creation of RTSP (Real-Time Streaming Protocol) servers and clients. When dealing specifically with H264 encoded video streams, live555 performs several key operations to ensure proper handling of data. In an H264 stream, important configuration information such as PPS (Picture Parameter Set) and SPS (Sequence Parameter Set) are crucial for decoding frames correctly. These parameters define how each frame should be interpreted by decoders. In the context of live555, this critical metadata is extracted during the SDP description phase rather than being embedded within individual RTP packets[^1]. Once these settings have been established through the initial setup process via RTSP DESCRIBE requests, subsequent RTP payloads transmitted over UDP contain only raw NAL units without any additional headers or parameter sets attached. This design choice reduces overhead while maintaining compatibility across different devices and applications using standardized protocols like RTP/RTCP. To access specific details about codec configurations after establishing connections, developers can utilize functions provided by live555's API, including `parseSPropParameterSets`, which parses base64-encoded strings from SDPs into usable binary formats suitable for passing directly onto other libraries responsible for actual playback or further processing tasks. #### Code Example Demonstrating How to Handle H264 Streams Using Live555 Library Below demonstrates basic steps involved when working with H264 content streamed over RTSP: ```cpp // Initialize environment variables required by LIVE555 TaskScheduler* scheduler = BasicTaskScheduler::createNew(); UsageEnvironment&amp; env(*scheduler); // Create URL object pointing towards target resource location char const* url = "rtsp://example.com/path/to/stream"; RTSPClient* rtsp_client = RTSPClient::createNew(env, url, 1 /* timeout */ ); if (!rtsp_client){ cerr << "Failed creating RTSP client!" << endl; } // Implement callback function to handle incoming media samples void afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds) { u_int8_t* buffer; // Buffer containing received sample // Process frame here... } ``` This code snippet initializes necessary components needed before initiating communication sessions between server-client pairs operating under RTSP protocol specifications. Additionally, it showcases implementing custom callbacks designed to manage newly arrived multimedia segments efficiently once they arrive at endpoints configured appropriately according to application requirements specified earlier on startup sequences outlined above. --related questions-- 1. What modifications would one need to make if intending to support multiple codecs simultaneously? 2. Can you explain more about parsing sprop-parameter-sets found inside SDP descriptions? 3. Are there alternative methods available besides utilizing parseSPropParameterSets() method offered natively within Live555 framework itself? 4. Is it possible to integrate FFMPEG alongside Live555 for enhanced functionality regarding transcoding processes involving various audiovisual standards supported today? 5. How does Live555 handle synchronization issues arising due to network jitter affecting real-time transmission quality adversely?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值