I am trying to play from local storage an encrypted video using ExoPlayer. The command used to encrypt the video using FFMPEG is as follows:
-i /storage/emulated/0/Download/20210125_193031.mp4 -vcodec copy -acodec copy -c:v libx264 -encryption_scheme cenc-aes-ctr -encryption_key b42ca3172ee4e69bf51848a59db9cd13 -encryption_kid 09e367028f33436ca5dd60ffe6671e70 /storage/emulated/0/Download/out_enc.mp4 - the file is playable using openkey and ffplay, but it won't play on ExoPlayer
The main issue seems the PSSH box seems to be missing when generating the encrypted file
Is there a command option in order to add the PSSH box inside the mp4 file? I think that's why the ExoPlayer is unable to play the file.
Related
I am trying to feed a mp4 file from ffmpeg to rtsp stream using the command on centos 7:
from console 1: ffmpeg -i space.mp4 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:8050/feed1.ffm
from console 2: I have started ffserver and it is started listening.
But when i open http://x.x.x.x:8050/feed1.ffm in browser it shows error:
File ??feed1.ffm? not found
My ffserver.conf file is attached
Browser can't play RTSP directly so you need it delivered in a HTML5 format (HLS) that can load inside a VIDEO tag.
You can directly embed the mp4 inside a VIDEO tag if you wish.
FFMPEG needs to publish the video/stream to a streaming server that supports RTSP or the format you decide to publish as.
You can schedule mp4 videos to play as a live stream with this tool https://broadcastlivevideo.com/schedule-video-playlist-as-live-streaming-channel/ , available as free open source WP plugin.
I'm trying to setup a wowza live test server and then I can play hls from my mobile app. It do work without any problem for vod. I can play it in my app. I can also see the .m3p8 file if I enter this uri in the browser.
I tried to do the same in live mode (my goal is to test some streaming parameters for live streaming). I tried to use ffmpeg to create the live stream:
ffmpeg -re -i "myInputTestVideo.mp4" -vcodec libx264 -vb 150000 -g 60 -vprofile baseline -level 2.1 -acodec aac -ab 64000 -ar 48000 -ac 2 -vbsf h264_mp4toannexb -strict experimental -f mpegts udp://127.0.0.1:10000
I created a "source file" and connected it to the "Incoming Streams".
I can see in my application's Monitoring / Network tab that it do getting the data from ffmpeg.
My problem is how to get the playlist.m3p8 file so I can play it from inside my app (hls based)?
Again, for now I need a way to test playing with the streaming settings and in real live I'll have a real live streaming source.
If I understand your issue correctly and since you said that it works for you with a VoD and its own m3u8 uri, you seem to not know how to construct an m3u8 uri for live sources referenced by a stream file (not source file as you incorrectly wrote).
Considering you named your stream file for example udp.stream (that's the file including the udp://127.0.0.1:10000 address), simply point your hls player application to http://{yourwowzaserver}/{yourliveapp}/udp.stream/playlist.m3u8
You could push it to Wowza as rtsp (much better than udp) and then stream it further on to where you want. To push it to Wowza you probably will need to setup a username and password (Server > Source authentication) and then the output stream from ffmpeg can look something like this: rtsp://{user}:{pass}#{yourwowzaserver}/{yourliveapp}/mystream.
In Wowza you will see mystream in Incomming streams. From there you can access it with the classic http(s)://wowzaip:wowzaport/{yourliveapp}/mystream/playlist.m3u8
Anyways, Wowza support both rtsp and udp so you could use directly. If you want transcoding, ffmpeg will be kinder to server resources than Wowza.
Worked:
To change the output of ffmpeg to -f rtsp rtsp://127.0.0.1:1935/my_app/my.stream.stream and use it as the input in wowza.
I want to segment a video file, create a playlist, encrypt it with AES 128 bit and stream it and play it using FFMPEG on windows platform.
I am able to segment the video file, create playlist. But i need help with AES encryption.
Below is the command i am using:
ffmpeg -i C:\Videos\Sample.mp4 -hls_time 30 -hls_key_info_file file.keyinfo -hls_segment_filename C:\Videos\Output\file%03d.ts C:\Videos\Output\out.m3u8
In my Output directory, I have 15 segmented video files with .ts extension(file000.ts - file014.ts) and 1 playlist file (out.m3u8).
Now out.m3u8 file is as below:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:38
#EXT-X-MEDIA-SEQUENCE:10
#EXTINF:28.653622,
file010.ts
#EXTINF:29.863167,
file011.ts
#EXTINF:37.412378,
file012.ts
#EXTINF:22.814456,
file013.ts
#EXTINF:16.057711,
file014.ts
#EXT-X-ENDLIST
Why is out.m3u8 file showing only file010.ts - file014.ts ?
Why is is not encrypting all the files?
What about the remaining files ?
What am i missing ?
I'm trying to setup a CRTMP serve by using its script run and its default script crtmpserver.lua. my os is centos6, and kenerl version 2.6.32.
The server start ok, showes
/crtmpserver/src/crtmpserver.cpp:267 GO! GO! GO!
But when i use ffmpeg to push a flv stream, using the command
ffmpeg -re -i test.flv -acodec copy -vcodec copy -f flv rtmp://localhost:1935/appselector/room1
it shows the error
RTMP_ReadPacket, failed to read RTMP packet header
rtmp://localhost:1935/appselector/room1: Operation not permitted
and the crtmpserver shows the following error
/applications/appselector/src/rtmpappprotocolhandler.cpp:66 appselector can be a final destination
/thelib/src/protocols/rtmp/basertmpprotocol.cpp:1049 Unable to send rtmp message
to application
/thelib/src/netio/epoll/tcpcarrier.cpp:89 Unable to signal data available
/thelib/src/netio/epoll/iohandlermanager.cpp:130 Handlers count changed: 11->10 IOHT_TCP_CARRIER
/thelib/src/protocols/protocolmanager.cpp:45 Enqueue for delete for protocol [IR(3)]
/thelib/src/application/baseclientapplication.cpp:246 Protocol [IR(3)] unregistered from application: appselector
Does the default lua config has some wrong?
I try many times for modifying lua config and success finally.
I remove the comment of aliases to make aliases work
--aliases(this comment do not remove)
{
"simpleLive",
"vod",
"live",
},
Run the command
ffmpeg -re -i test.flv -acodec copy -vcodec copy -f flv rtmp://localhost:1935/live/room1
and it work!
I dont't know the reason
How to transfer metadata using FFMPEG or other tools with CMD ?
I'm trying to encode video/audio and since they already have metadata inside obviously i want to preserve them into my new file
btw since i'm using mediamonkey as main player, there's also some Custom metadata. this is the one who wont transfer
for Video output file using mp4/mkv (using x264)
for Audio output file using m4a (using neroAac)
Thank You!
ps. which container is best for neroAac and x264? since i can't seem to edit mkv metadata (when i remove from mediamonkey playlist, they're all gone), mp4 is fine though and i can't seem to play AAC, although it's fine when muxed into video
Copy all custom and global metadata tag information using the following command:
ffmpeg <inputfile> -movflags use_metadata_tags -c copy <outputfile>