
Recherche avancée
Autres articles (53)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (7831)
-
Transcoding with the GCP Transcoder API results in a time gap
3 mars 2021, par banyanI've been trying GCP's Transcoder API and having trouble with the time randomly becoming shorter than specified in certain cases.


The specific cases are as follows :


- 

- Specifying
startTimeOffset
andendTimeOffset
(cut off 2 seconds before and after the video) - fMP4 is used as container
- input video is mp4 with screen recording on iPad Pro








For example, if I don't specify
startTimeOffset
andendTimeOffset
, the time will not be shortened. Also, there is no problem when MPEG2-TS is specified for container. There may be a problem with the video itself, but I haven't found a clue how to set it up.

I'm not sure whether this is a problem with the Transcoder API or with me.


The test input video : https://gofile.io/d/DUT9rr


❯ ffprobe input.mp4
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
 built with Apple clang version 12.0.0 (clang-1200.0.32.28)
 configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 1
 compatible_brands: isommp41mp42
 creation_time : 2021-02-26T15:08:58.000000Z
 Duration: 00:02:51.15, start: 0.000000, bitrate: 551 kb/s
 Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 246 kb/s (default)
 Metadata:
 creation_time : 2021-02-26T15:08:58.000000Z
 handler_name : Core Media Audio
 Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709/bt709/iec61966-2-1), 1920x1342, 302 kb/s, 12.39 fps, 120 tbr, 600 tbn, 1200 tbc (default)
 Metadata:
 rotate : 180
 creation_time : 2021-02-26T15:08:58.000000Z
 handler_name : Core Media Video
 Side data:
 displaymatrix: rotation of -180.00 degrees



#!/bin/bash -eu

cat > request.json << EOF
{
 "config": {
 "inputs": [
 {
 key: "input0"
 }
 ],
 "editList": [
 {
 "key": "atom0",
 "inputs": [
 "input0"
 ],
 "startTimeOffset": "2s",
 "endTimeOffset": "169s",
 },
 ],
 "elementaryStreams": [
 {
 "videoStream": {
 "codec": "h265",
 "heightPixels": 480,
 "bitrateBps": 1200000,
 "rateControlMode": "vbr",
 "enableTwoPass": true,
 "frameRate": 30,
 "crfLevel": 31,
 "gopDuration": "3.0s",
 },
 "key": "h265-stream0"
 },
 {
 "videoStream": {
 "codec": "h265",
 "heightPixels": 720,
 "bitrateBps": 1550000,
 "rateControlMode": "vbr",
 "enableTwoPass": true,
 "frameRate": 30,
 "crfLevel": 31,
 "gopDuration": "3.0s",
 },
 "key": "h265-stream1"
 },
 {
 "videoStream": {
 "codec": "h265",
 "heightPixels": 1080,
 "bitrateBps": 2600000,
 "rateControlMode": "vbr",
 "enableTwoPass": true,
 "frameRate": 30,
 "crfLevel": 31,
 "gopDuration": "3.0s",
 },
 "key": "h265-stream2"
 },
 {
 "audioStream": {
 "codec": "aac",
 "bitrateBps": 64000,
 "channelCount": 2,
 "channelLayout": [
 "fl",
 "fr"
 ],
 "sampleRateHertz": 48000
 },
 "key": "audio-stream0"
 },
 ],
 "muxStreams": [
 {
 "key": "media-sd",
 "fileName": "media-sd.m4s",
 "container": "fmp4",
 "elementaryStreams": [
 "h265-stream0",
 ],
 "segmentSettings": {
 "individualSegments": true
 },
 },
 {
 "key": "media-hd",
 "fileName": "media-hd.m4s",
 "container": "fmp4",
 "elementaryStreams": [
 "h265-stream1",
 ],
 "segmentSettings": {
 "individualSegments": true
 },
 },
 {
 "key": "media-fhd",
 "fileName": "media-fhd.m4s",
 "container": "fmp4",
 "elementaryStreams": [
 "h265-stream2",
 ],
 "segmentSettings": {
 "individualSegments": true
 },
 },
 {
 "key": "audio-only",
 "fileName": "audio-only.m4s",
 "container": "fmp4",
 "elementaryStreams": [
 "audio-stream0"
 ],
 "segmentSettings": {
 "individualSegments": true
 },
 },
 ],
 "manifests": [
 {
 "fileName": "manifest-h265.mpd",
 "type": "DASH",
 "muxStreams": [
 "media-sd",
 "media-hd",
 "media-fhd",
 "audio-only",
 ]
 },
 ]
 }
}
EOF

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://transcoder.googleapis.com/v1beta1/projects/MY_PROJECT/locations/asia-east1/jobTemplates?jobTemplateId=test-template



#!/bin/bash -eu

cat > request.json << EOF
{
 "inputUri": "gs://my-bucket/input.mp4",
 "outputUri": "gs://my-bucket/output/",
 "templateId": "test-template"
}
EOF

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://transcoder.googleapis.com/v1beta1/projects/MY_PROJECT/locations/asia-east1/jobs



The following is a ffprobe of the resulting manifest file, which is 2 seconds shorter than specified. (expected :
00:02:47.00
, actual :00:02:45.00
) In this case, it's a 2-second gap, but it can be 10 seconds or 30 seconds, and it varies from video to video.

❯ ffprobe manifest-h265.mpd
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
 built with Apple clang version 12.0.0 (clang-1200.0.32.28)
 configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, dash, from 'manifest-h265.mpd':
 Duration: 00:02:45.00, start: 0.000000, bitrate: 0 kb/s
 Program 0
 Stream #0:0: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709/unknown/unknown), 686x480, 112 kb/s, 30 fps, 120 tbr, 10k tbn, 30 tbc
 Metadata:
 variant_bitrate : 113679
 id : 113679
 Stream #0:1: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709/unknown/unknown), 1030x720, 205 kb/s, 30 fps, 120 tbr, 10k tbn, 30 tbc
 Metadata:
 variant_bitrate : 189219
 id : 189219
 Stream #0:2: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709/unknown/unknown), 1544x1080, 384 kb/s, 30 fps, 120 tbr, 10k tbn, 30 tbc
 Metadata:
 variant_bitrate : 358043
 id : 358043
 Stream #0:3: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 65 kb/s
 Metadata:
 variant_bitrate : 70245
 id : 70245



The following is the time as specified for h264 + MPEG2-TS + Apple HLS.


❯ ffprobe manifest-h264.m3u8 | pbcopy
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
 built with Apple clang version 12.0.0 (clang-1200.0.32.28)
 configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
[hls @ 0x7fe23100f200] Opening 'h264-sd-ts.m3u8' for reading
[hls @ 0x7fe23100f200] Skip ('#EXT-X-VERSION:4')
[hls @ 0x7fe23100f200] Opening 'h264-hd-ts.m3u8' for reading
[hls @ 0x7fe23100f200] Skip ('#EXT-X-VERSION:4')
[hls @ 0x7fe23100f200] Opening 'h264-fhd-ts.m3u8' for reading
[hls @ 0x7fe23100f200] Skip ('#EXT-X-VERSION:4')
[hls @ 0x7fe23100f200] Opening 'h264-sd0000000000.ts' for reading
[hls @ 0x7fe23100f200] Opening 'h264-hd0000000000.ts' for reading
[hls @ 0x7fe23100f200] Opening 'h264-fhd0000000000.ts' for reading
Input #0, hls, from 'manifest-h264.m3u8':
 Duration: 00:02:47.00, start: 0.000000, bitrate: 0 kb/s
 Program 0
 Metadata:
 variant_bitrate : 511576
 Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 686x480, 120 tbr, 90k tbn, 2000k tbc
 Metadata:
 variant_bitrate : 511576
 Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
 Metadata:
 variant_bitrate : 511576
 Program 1
 Metadata:
 variant_bitrate : 793711
 Stream #0:2: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1030x720, 120 tbr, 90k tbn, 2000k tbc
 Metadata:
 variant_bitrate : 793711
 Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
 Metadata:
 variant_bitrate : 793711
 Program 2
 Metadata:
 variant_bitrate : 1305288
 Stream #0:4: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1544x1080, 120 tbr, 90k tbn, 2000k tbc
 Metadata:
 variant_bitrate : 1305288
 Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
 Metadata:
 variant_bitrate : 1305288



- Specifying
-
FFmpeg Error while filtering : Cannot allocate memory While Using Gifs Overlay Over Video
4 mars 2021, par Abhishek Sharmacreating overlay gif over video but One gif is stoping after one loop and all other gifs are in a continuous loop by default in the file and FFmpeg throws an error


Command :


ffmpeg -y -i "2021_03_04_03_54_43.mp4" -f lavfi -i "color=000000:s=540x960" -ignore_loop 0 -i "2021_03_04_03_55_08.gif" -ignore_loop 0 -i "2021_03_04_03_56_19.gif" -ignore_loop 0 -i "2021_03_04_04_02_29.gif" -ignore_loop 0 -i "2021_03_04_04_03_50.gif" -filter_complex "[0:v]trim=0:15.047,setpts=PTS-STARTPTS[Clip_0_VideoTrim_0] ;[0:a]atrim=0:15.047,asetpts=PTS-STARTPTS,volume=1[Clip_0_AudioTrim_0] ;[1:v]crop=540:960:0:0,boxblur=luma_radius=10:chroma_radius=10:luma_power=1,scale=540:960[Clip_0_BG] ;[Clip_0_VideoTrim_0]scale=540:960[Clip_0_FG] ;[Clip_0_BG][Clip_0_FG]overlay=0:0:shortest=1[Clip_0_BackgroundOutput] ;[Clip_0_BackgroundOutput][Clip_0_AudioTrim_0]concat=n=1:v=1:a=1[ClipsVideoOut][ClipsAudioOut] ;[2:v]format=yuva444p,colorchannelmixer=aa=1,scale=226.374008178711 :-1,rotate=0:c=none:ow=rotw(0):oh=roth(0)[OverLay_2] ;[ClipsVideoOut][OverLay_2]overlay=enable='between(t,3.839,7.6)':x='(389.626037597656-(overlay_w/2))':y='(205.619873046875-(overlay_h/2))':shortest=1[OverlayLayer_2] ;[3:v]format=yuva444p,colorchannelmixer=aa=1,scale=179.254348754883 :-1,rotate=0:c=none:ow=rotw(0):oh=roth(0)[OverLay_3] ;[OverlayLayer_2][OverLay_3]overlay=enable='between(t,0,3.762)':x='(117.589767456055-(overlay_w/2))':y='(759.018127441406-(overlay_h/2))':shortest=1[OverlayLayer_3] ;[4:v]format=yuva444p,colorchannelmixer=aa=1,scale=326.199066162109 :-1,rotate=0:c=none:ow=rotw(0):oh=roth(0)[OverLay_4] ;[OverlayLayer_3][OverLay_4]overlay=enable='between(t,7.478,11.24)':x='(118.761810302734-(overlay_w/2))':y='(153.96012878418-(overlay_h/2))':shortest=1[OverlayLayer_4] ;[5:v]format=yuva444p,colorchannelmixer=aa=1,scale=268.915679931641 :-1,rotate=0:c=none:ow=rotw(0):oh=roth(0)[OverLay_5] ;[OverlayLayer_4][OverLay_5]overlay=enable='between(t,11.25,15.011)':x='(396.322570800781-(overlay_w/2))':y='(747.451477050781-(overlay_h/2))':shortest=1[OverlayOutput] ;[OverlayOutput][ClipsAudioOut]concat=n=1:v=1:a=1[OutputVideo][OutputAudio]" -map [OutputVideo] -map [OutputAudio] -c:v libx264 -c:a aac -b:a 256k -r 30 -preset ultrafast "2021_03_04_04_04_09.mp4" -hide_banner" ;


ffmpeg Log :


2021-03-04 16:04:10.092 +05:30 [INF] Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2021_03_04_03_54_43.mp4':
2021-03-04 16:04:10.100 +05:30 [INF] Metadata:
2021-03-04 16:04:10.112 +05:30 [INF] major_brand : isom
2021-03-04 16:04:10.123 +05:30 [INF] minor_version : 512
2021-03-04 16:04:10.131 +05:30 [INF] compatible_brands: isomiso2avc1mp41
2021-03-04 16:04:10.141 +05:30 [INF] encoder : Lavf57.76.100
2021-03-04 16:04:10.151 +05:30 [INF] comment : vid:v090444d0000bivu4o5qa7loe16h27e0
2021-03-04 16:04:10.164 +05:30 [INF] genre : aweme_6677028628938787590
2021-03-04 16:04:10.202 +05:30 [INF] Duration: 00:00:15.05, start: 0.000000, bitrate: 1562 kb/s
2021-03-04 16:04:10.253 +05:30 [INF] Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 540x960, 1485 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
2021-03-04 16:04:10.262 +05:30 [INF] Metadata:
2021-03-04 16:04:10.275 +05:30 [INF] handler_name : VideoHandler
2021-03-04 16:04:10.303 +05:30 [INF] Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
2021-03-04 16:04:10.309 +05:30 [INF] Metadata:
2021-03-04 16:04:10.325 +05:30 [INF] handler_name : SoundHandler
2021-03-04 16:04:10.334 +05:30 [INF] Input #1, lavfi, from 'color=000000:s=540x960':
2021-03-04 16:04:10.366 +05:30 [INF] Duration: N/A, start: 0.000000, bitrate: N/A
2021-03-04 16:04:10.403 +05:30 [INF] Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 540x960 [SAR 1:1 DAR 9:16], 25 tbr, 25 tbn, 25 tbc
2021-03-04 16:04:10.416 +05:30 [INF] Input #2, gif, from '2021_03_04_03_55_08.gif':
2021-03-04 16:04:10.482 +05:30 [INF] Duration: 00:00:00.20, start: 0.000000, bitrate: 2071 kb/s
2021-03-04 16:04:10.536 +05:30 [INF] Stream #2:0: Video: gif, bgra, 269x386, 14.25 fps, 19.08 tbr, 100 tbn, 100 tbc
2021-03-04 16:04:10.570 +05:30 [INF] Input #3, gif, from '2021_03_04_03_56_19.gif':
2021-03-04 16:04:10.616 +05:30 [INF] Duration: 00:00:01.47, start: 0.000000, bitrate: 11618 kb/s
2021-03-04 16:04:10.666 +05:30 [INF] Stream #3:0: Video: gif, bgra, 300x300, 28.92 fps, 100 tbr, 100 tbn, 100 tbc
2021-03-04 16:04:10.680 +05:30 [INF] Input #4, gif, from '2021_03_04_04_02_29.gif':
2021-03-04 16:04:10.714 +05:30 [INF] Duration: 00:00:00.90, start: 0.000000, bitrate: 824 kb/s
2021-03-04 16:04:10.793 +05:30 [INF] Stream #4:0: Video: gif, bgra, 310x300, 20.67 fps, 19.75 tbr, 100 tbn, 100 tbc
2021-03-04 16:04:10.811 +05:30 [INF] Input #5, gif, from '2021_03_04_04_03_50.gif':
2021-03-04 16:04:10.845 +05:30 [INF] Duration: 00:00:00.48, start: 0.000000, bitrate: 1516 kb/s
2021-03-04 16:04:10.871 +05:30 [INF] Stream #5:0: Video: gif, bgra, 480x480, 14.33 fps, 12.25 tbr, 100 tbn, 100 tbc
2021-03-04 16:04:10.882 +05:30 [INF] Stream mapping:
2021-03-04 16:04:10.891 +05:30 [INF] Stream #0:0 (h264) -> trim
2021-03-04 16:04:10.901 +05:30 [INF] Stream #0:1 (aac) -> atrim
2021-03-04 16:04:10.913 +05:30 [INF] Stream #1:0 (rawvideo) -> crop
2021-03-04 16:04:10.918 +05:30 [INF] Stream #2:0 (gif) -> format
2021-03-04 16:04:10.926 +05:30 [INF] Stream #3:0 (gif) -> format
2021-03-04 16:04:10.932 +05:30 [INF] Stream #4:0 (gif) -> format
2021-03-04 16:04:10.935 +05:30 [INF] Stream #5:0 (gif) -> format
2021-03-04 16:04:10.943 +05:30 [INF] concat:out:v0 -> Stream #0:0 (libx264)
2021-03-04 16:04:10.949 +05:30 [INF] concat:out:a0 -> Stream #0:1 (aac)
2021-03-04 16:04:10.951 +05:30 [INF] Press [q] to stop, [?] for help
2021-03-04 16:04:10.960 +05:30 [INF] frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A 
2021-03-04 16:04:11.070 +05:30 [INF] [libx264 @ 2013EB00] using SAR=1/1
2021-03-04 16:04:11.092 +05:30 [INF] [libx264 @ 2013EB00] using cpu capabilities: none!
2021-03-04 16:04:11.116 +05:30 [INF] [libx264 @ 2013EB00] profile Constrained Baseline, level 3.1, 4:2:0, 8-bit
2021-03-04 16:04:11.119 +05:30 [INF] [libx264 @ 2013EB00] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
2021-03-04 16:04:11.126 +05:30 [INF] Output #0, mp4, to '2021_03_04_04_04_09.mp4':
2021-03-04 16:04:11.129 +05:30 [INF] Metadata:
2021-03-04 16:04:11.136 +05:30 [INF] major_brand : isom
2021-03-04 16:04:11.251 +05:30 [INF] minor_version : 512
2021-03-04 16:04:11.261 +05:30 [INF] compatible_brands: isomiso2avc1mp41
2021-03-04 16:04:11.274 +05:30 [INF] genre : aweme_6677028628938787590
2021-03-04 16:04:11.282 +05:30 [INF] comment : vid:v090444d0000bivu4o5qa7loe16h27e0
2021-03-04 16:04:11.293 +05:30 [INF] encoder : Lavf58.45.100
2021-03-04 16:04:11.324 +05:30 [INF] Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 540x960 [SAR 1:1 DAR 9:16], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
2021-03-04 16:04:11.328 +05:30 [INF] Metadata:
2021-03-04 16:04:11.338 +05:30 [INF] encoder : Lavc58.91.100 libx264
2021-03-04 16:04:11.341 +05:30 [INF] Side data:
2021-03-04 16:04:11.358 +05:30 [INF] cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
2021-03-04 16:04:11.377 +05:30 [INF] Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 256 kb/s (default)
2021-03-04 16:04:11.380 +05:30 [INF] Metadata:
2021-03-04 16:04:11.392 +05:30 [INF] encoder : Lavc58.91.100 aac
2021-03-04 16:04:11.469 +05:30 [INF] frame= 2 fps=0.0 q=0.0 size= 0kB time=00:00:00.04 bitrate= 8.3kbits/s speed=0.0928x 
2021-03-04 16:04:11.972 +05:30 [INF] frame= 16 fps= 16 q=25.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/s dup=3 drop=0 speed=0.463x 
2021-03-04 16:04:12.480 +05:30 [INF] frame= 28 fps= 18 q=23.0 size= 256kB time=00:00:00.88 bitrate=2377.2kbits/s dup=5 drop=0 speed=0.582x 
2021-03-04 16:04:13.012 +05:30 [INF] frame= 41 fps= 20 q=23.0 size= 256kB time=00:00:01.34 bitrate=1557.5kbits/s dup=7 drop=0 speed=0.664x 
2021-03-04 16:04:13.493 +05:30 [INF] frame= 53 fps= 21 q=25.0 size= 512kB time=00:00:01.76 bitrate=2377.0kbits/s dup=9 drop=0 speed=0.696x 
2021-03-04 16:04:14.023 +05:30 [INF] frame= 66 fps= 22 q=22.0 size= 768kB time=00:00:02.18 bitrate=2882.6kbits/s dup=11 drop=0 speed=0.714x 
2021-03-04 16:04:14.535 +05:30 [INF] frame= 77 fps= 22 q=23.0 size= 768kB time=00:00:02.57 bitrate=2441.1kbits/s dup=13 drop=0 speed=0.724x 
2021-03-04 16:04:15.030 +05:30 [INF] frame= 91 fps= 22 q=24.0 size= 1024kB time=00:00:03.01 bitrate=2779.1kbits/s dup=15 drop=0 speed=0.743x 
2021-03-04 16:04:15.547 +05:30 [INF] frame= 104 fps= 23 q=23.0 size= 1280kB time=00:00:03.45 bitrate=3030.9kbits/s dup=17 drop=0 speed=0.756x 
2021-03-04 16:04:16.118 +05:30 [INF] frame= 109 fps= 21 q=23.0 size= 1280kB time=00:00:04.78 bitrate=2192.2kbits/s dup=18 drop=0 speed=0.942x 
2021-03-04 16:04:16.543 +05:30 [INF] frame= 109 fps= 20 q=23.0 size= 1280kB time=00:00:06.61 bitrate=1584.6kbits/s dup=18 drop=0 speed=1.19x 
2021-03-04 16:04:17.042 +05:30 [INF] frame= 109 fps= 18 q=23.0 size= 1280kB time=00:00:08.82 bitrate=1188.4kbits/s dup=18 drop=0 speed=1.45x 
2021-03-04 16:04:17.545 +05:30 [INF] frame= 109 fps= 17 q=23.0 size= 1280kB time=00:00:10.89 bitrate= 962.9kbits/s dup=18 drop=0 speed=1.65x 
2021-03-04 16:04:17.864 +05:30 [INF] Error while filtering: Cannot allocate memory
2021-03-04 16:04:17.889 +05:30 [INF] Failed to inject frame into filter network: Cannot allocate memory
2021-03-04 16:04:17.908 +05:30 [INF] Error while processing the decoded data for stream #0:0
2021-03-04 16:04:18.048 +05:30 [INF] [libx264 @ 2013EB00] frame I:1 Avg QP:20.00 size: 43401
2021-03-04 16:04:18.051 +05:30 [INF] [libx264 @ 2013EB00] frame P:101 Avg QP:23.36 size: 13076
2021-03-04 16:04:18.054 +05:30 [INF] [libx264 @ 2013EB00] mb I I16..4: 100.0% 0.0% 0.0%
2021-03-04 16:04:18.058 +05:30 [INF] [libx264 @ 2013EB00] mb P I16..4: 11.9% 0.0% 0.0% P16..4: 44.6% 0.0% 0.0% 0.0% 0.0% skip:43.5%
2021-03-04 16:04:18.062 +05:30 [INF] [libx264 @ 2013EB00] coded y,uvDC,uvAC intra: 34.5% 62.9% 16.0% inter: 23.5% 29.1% 3.2%
2021-03-04 16:04:18.064 +05:30 [INF] [libx264 @ 2013EB00] i16 v,h,dc,p: 35% 20% 19% 25%
2021-03-04 16:04:18.067 +05:30 [INF] [libx264 @ 2013EB00] i8c dc,h,v,p: 34% 22% 33% 12%
2021-03-04 16:04:18.071 +05:30 [INF] [libx264 @ 2013EB00] kb/s:3209.61
2021-03-04 16:04:18.076 +05:30 [INF] [aac @ 2013C440] Qavg: 2650.414
2021-03-04 16:04:18.081 +05:30 [INF] [aac @ 2013C440] 2 frames left in the queue on closing
2021-03-04 16:04:18.099 +05:30 [INF] Conversion failed!



-
Safari on Mac and IOS 14 Won't Play HTML 5 MP4 Video
10 mars 2021, par Glen ElkinsSo i have developed a chat application that uses node for the back-end. When a user selects a video on their iphone it usually is .mov format so when it's sent to the node server it's then converted to mp4 with ffmpeg. All that works fine, then if i load up my chat again in Chrome on my mac the video plays just fine as the mp4.




This screenshot shows the video embed is there, set to mp4 yet it won't play in Safari on my mac or my phone, in fact it just shows the video as 0 seconds long yet i can play it in chrome and also download the mp4 file by accessing the embed url directly.


Any ideas ? I had it convert to mp4 to prevent things like this, but safari doesn't seem to even like mp4 files.


The back-end part that serves the private file is in Symfony 4 (PHP) :


/**
 * @Route("/private/files/download/{base64Path}", name="downloadFile")
 * @param string $base64Path
 * @param Request $request
 * @return Response
 */
 public function downloadFile(string $base64Path, Request $request) : Response
 {


 // get token
 if(!$token = $request->query->get('token')){
 return new Response('Access Denied',403);
 }



 /** @var UserRepository $userRepo */
 $userRepo = $this->getDoctrine()->getRepository(User::class);

 /** @var User $user */
 if(!$user = $userRepo->findOneBy(['deleted'=>false,'active'=>true,'systemUser'=>false,'apiKey'=>$token])){
 return new Response('Access Denied',403);
 }



 // get path
 if($path = base64_decode($base64Path)){

 // make sure the folder we need exists
 $fullPath = $this->getParameter('private_upload_folder') . '/' . $path;



 if(!file_exists($fullPath)){
 return new Response('File Not Found',404);
 }

 

 $response = new Response();
 $response->headers->set('Content-Type', mime_content_type($fullPath));
 $response->headers->set('Content-Disposition', 'inline; filename="' . basename($fullPath) . '"');
 $response->headers->set('Content-Length', filesize($fullPath));
 $response->headers->set('Pragma', "no-cache");
 $response->headers->set('Expires', "0");
 $response->headers->set('Content-Transfer-Encoding', "binary");

 $response->sendHeaders();

 $response->setContent(readfile($fullPath));

 return $response;
 }

 return new Response('Invalid Path',404);
 }



This works fine everywhere except safari when trying to embed the video. It's done like this because the videos are not public and need an access token.


UPDATE : Here is a test link of an mp4, you'll have to allow the insecure certificate as it's on a quick test sub domain. If you open it in chrome, you'll see a 3 second video of my 3d printer curing station, if you load the same link in safari, you'll see it doesn't work




The server runs on cPanel with Apache and i think it might be something to do with the video needs streaming ?


UPDATED CODE THAT WORKS IN SAFARI BUT NOW BROKEN IN CHROME :


Chrome is now giving Content-Length : 0 but it's working fine in safari.


public function downloadFile(string $base64Path, Request $request) : ?Response
 {

 ob_clean();

 // get token
 if(!$token = $request->query->get('token')){
 return new Response('Access Denied',403);
 }


 

 /** @var UserRepository $userRepo */
 $userRepo = $this->getDoctrine()->getRepository(User::class);

 /** @var User $user */
 if(!$user = $userRepo->findOneBy(['deleted'=>false,'active'=>true,'systemUser'=>false,'apiKey'=>$token])){
 return new Response('Access Denied',403);
 }



 // get path
 if($path = base64_decode($base64Path)){

 // make sure the folder we need exists
 $fullPath = $this->getParameter('private_upload_folder') . '/' . $path;



 if(!file_exists($fullPath)){
 return new Response('File Not Found',404);
 }


 $filesize = filesize($fullPath);
 $mime = mime_content_type($fullPath);

 header('Content-Type: ' . $mime);

 if(isset($_SERVER['HTTP_RANGE'])){

 // Parse the range header to get the byte offset
 $ranges = array_map(
 'intval', // Parse the parts into integer
 explode(
 '-', // The range separator
 substr($_SERVER['HTTP_RANGE'], 6) // Skip the `bytes=` part of the header
 )
 );



 // If the last range param is empty, it means the EOF (End of File)
 if(!$ranges[1]){
 $ranges[1] = $filesize - 1;
 }

 header('HTTP/1.1 206 Partial Content');
 header('Accept-Ranges: bytes');
 header('Content-Length: ' . ($ranges[1] - $ranges[0])); // The size of the range

 // Send the ranges we offered
 header(
 sprintf(
 'Content-Range: bytes %d-%d/%d', // The header format
 $ranges[0], // The start range
 $ranges[1], // The end range
 $filesize // Total size of the file
 )
 );

 // It's time to output the file
 $f = fopen($fullPath, 'rb'); // Open the file in binary mode
 $chunkSize = 8192; // The size of each chunk to output

 // Seek to the requested start range
 fseek($f, $ranges[0]);

 // Start outputting the data
 while(true){
 // Check if we have outputted all the data requested
 if(ftell($f) >= $ranges[1]){
 break;
 }

 // Output the data
 echo fread($f, $chunkSize);

 // Flush the buffer immediately
 @ob_flush();
 flush();
 }
 }else{

 // It's not a range request, output the file anyway
 header('Content-Length: ' . $filesize);

 // Read the file
 @readfile($filesize);

 // and flush the buffer
 @ob_flush();
 flush();



 }

 }else {

 return new Response('Invalid Path', 404);
 }
 }



I have notice in chrome that it's sending the range header like this :


Range : bytes=611609-


Where safari sends


Range : bytes=611609-61160


So for some reason chrome is missing the second range amount, that obviously means my code can't find a range number for the second one.


Doesn’t matter what I do I can’t get it working in both chrome and safari. Safari wants the byte range part , chrome seems to request it then sends a new request for the full file but even the full file part of the code gives a 500 error. If I take out the byte range bit then it works fine in chrome but not safari.


UPDATE :


Here is some strange things going on in chrome :


For the video i am testing with it makes 3 range requests :


REQUEST 1 HEADERS - asking for bytes 0- (to the end of the file)


GET /private/files/download/Y2hhdC83Nzk1Y2U2MC04MDFmLTExZWItYjkzYy1lZjI4ZGYwMDhkOTMubXA0?token=6ab1720bfe922d44208c25f655d61032 HTTP/1.1

Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36
Accept-Encoding: identity;q=1, *;q=0
Accept: */*
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: video
Referer: https://gofollow.vip/
Accept-Language: en-US,en;q=0.9
Range: bytes=0-



RESPONSE GIVES IT BACK ALL THE BYTES IN THE FILE AS THAT'S WHAT WAS ASKED FOR BY CHROME :


HTTP/1.1 206 Partial Content
Date: Wed, 10 Mar 2021 12:35:54 GMT
Server: Apache
Accept-Ranges: bytes
Content-Length: 611609
Content-Range: bytes 0-611609/611610
Vary: User-Agent
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: video/mp4



SECOND REQUEST HEADERS : NOW IT'S ASKING FOR 589824 to the end of the file :


Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36
Accept-Encoding: identity;q=1, *;q=0
Accept: */*
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: video
Referer: https://gofollow.vip/
Accept-Language: en-US,en;q=0.9
Range: bytes=589824-



RESPONSE OBLIGES :


HTTP/1.1 206 Partial Content
Date: Wed, 10 Mar 2021 12:35:55 GMT
Server: Apache
Accept-Ranges: bytes
Content-Length: 21785
Content-Range: bytes 589824-611609/611610
Vary: User-Agent
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: video/mp4



THEN IT'S MAKING THIS 3rd REQUEST THAT GIVES AN INTERNAL SERVER ERORR, THIS TIME IT'S LITERALLY ASKING FOR THE LAST BYTE :


GET /private/files/download/Y2hhdC83Nzk1Y2U2MC04MDFmLTExZWItYjkzYy1lZjI4ZGYwMDhkOTMubXA0?token=6ab1720bfe922d44208c25f655d61032 HTTP/1.1

Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36
Accept-Encoding: identity;q=1, *;q=0
Accept: */*
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: video
Referer: https://gofollow.vip/
Accept-Language: en-US,en;q=0.9
Range: bytes=611609-



RESPONSE - THE CONTENT LENGTH IS 0 BECAUSE THERE IS NO DIFFERENCE BETWEEN THE REQUESTED BYTES AND THE BYTES RETURNED :


HTTP/1.1 500 Internal Server Error
Date: Wed, 10 Mar 2021 12:35:56 GMT
Server: Apache
Accept-Ranges: bytes
Cache-Control: max-age=0, must-revalidate, private
X-Frame-Options: DENY
X-XSS-Protection: 1
X-Content-Type-Options: nosniff
Referrer-Policy: origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
Expires: Wed, 10 Mar 2021 12:35:56 GMT
Content-Length: 0
Content-Range: bytes 611609-611609/611610
Vary: User-Agent
Connection: close
Content-Type: text/html; charset=UTF-8