Recherche avancée

Médias (91)

Autres articles (34)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (6793)

  • ffmpeg streaming fails to stream over internet to twitch.tv

    15 avril 2021, par josh joyer

    I did already streaming to twitch.tv with command :

    


    ffmpeg -stream_loop -1 -i 9stream.wav 
-f dshow -i audio="mic"
 -f dshow -i audio="realTek" 
-filter_complex "[0:a]volume=2[a0];[1:a]volume=1.5[a1];[2:a]volume=1.5[a2];[a0][a1][a2]amix=inputs=3"
 -f dshow -i video="USB2.0 PC CAMERA" 
-ac 1 -ar 11025 -acodec libmp3lame -c:v libx264 -b:v 100k -f flv -s 80x120 
rtmp://live.twitch.tv/app/live_streamingKey


    


    It was most advanced command that I used to stream online.

    


    (I do not know how to make enter in here so I put double enter)

    


    9stream.wav was played in loop as background music

    


    microphone was added

    


    stereoMix named realTek was the playback of system sounds

    


    volume was adjusted and all sounds mixed into one stream

    


    camera view was added

    


    THEN network flow was reduced by sending only one channel with low frequency of 11025 with lowest

    


    possible data size made by mp3 encoder and libx264 was used to encode video in png files.

    


    It was working fine SO I decided to make final version

    


    (this one worked with all sounds(background music,microphone,system sounds) and camera)

    


    Final version was about adding screen view and logo.

    


    I succeded writing everything to disc with command :

    


    ffmpeg 
-stream_loop -1 -i 9stream.wav 
-f dshow -i audio="mic" 
-f dshow -i audio="stereoMixRealtek" 
-i camera.png 
-f gdigrab -framerate 1 -i desktop 
-f dshow -framerate 15 -i video="USB2.0 PC CAMERA" 
-filter_complex "[0:a]volume=2[a0];[1:a]volume=1.5[a1];[2:a]volume=1.5[a2];
[a0][a1][a2]amix=inputs=3[aMix];
[4:v]scale=200:-1[v4];[5:v]scale=50:-1[v5];
[v4][v5]overlay=(W-w)-5:(H-h)-5[vScreenCam];
[vScreenCam][3:v]overlay=5:5[v]" 
-map "[v]" -map "[aMix]" -ac 1 -ar 11025 -c:a libmp3lame -r 1 -c:v libx264 output.mkv


    


    That was

    


    background music

    


    microphone

    


    system sounds

    


    logo picture

    


    screen view

    


    camera

    


    adjusting sound volume

    


    mixing sounds

    


    reducing size of screen view and camera view

    


    overlaying reduced camera view over reduced screen view

    


    adding logo

    


    choosing final view, final mixed sounds,

    


    reducing data size to one channel, reducing sample frequency,

    


    choosing mp3 codec to reduce final data size,

    


    choosing minimal framerate of one per second to reduce data size

    


    choosing libx264 codec for video.

    


    THEN I tried to use final command for network streaming with slight modification :

    


    ffmpeg 
-stream_loop -1 -i 9stream.wav 
-f dshow -i audio="mic" 
-f dshow -i audio="stereo mix" 
-i camera.png 
-f gdigrab -framerate 1 -i desktop 
-f dshow -framerate 15 -i video="USB2.0 PC CAMERA" 
-filter_complex "[0:a]volume=2[a0];[1:a]volume=1.5[a1];[2:a]volume=1.5[a2];
[a0][a1][a2]amix=inputs=3[aMix];
[4:v]scale=200:-1[v4];[5:v]scale=50:-1[v5];
[v4][v5]overlay=(W-w)-5:(H-h)-5[vScreenCam];[vScreenCam][3:v]overlay=5:5[v]" 
-map "[v]" -map "[aMix]" 
-ac 1 -ar 11025 -c:a libmp3lame -r 1 -c:v libx264 -b:v 100k -b:a 10k -f flv rtmp://live.twitch.tv/app/live_streamingKey


    


    I added parameter
-b:v 100k to reduce video flow
-b:a 10k to reduce sound flow
-f flv to be good for twitch.tv otherwise it would not accept stream

    


    BUT ffmpeg is always stopping sending data with message like this :

    


    testosteron_@testosteron MINGW64 ~/Desktop/2021b/magisterka/ScreenRecorderXi/ScreenRecorderXi/bin
$ cmd
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Wszelkie prawa zastrze▒one.

C:\Users\testosteron_\Desktop\2021b\magisterka\ScreenRecorderXi\ScreenRecorderXi\bin>ffmpeg -stream_loop -1 -i 9stream.wav -f dshow -i audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5B4DB0B5-B645-4AFA-930D-4710AAF753DB}" -f dshow -i audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{ADECEC1D-C3CC-4BAE-8516-752251B8B63F}" -i camera.png -f gdigrab -framerate 1 -i desktop -f dshow -framerate 15 -i video="USB2.0 PC CAMERA" -filter_complex "[0:a]volume=2[a0];[1:a]volume=1.5[a1];[2:a]volume=1.5[a2];[a0][a1][a2]amix=inputs=3[aMix];[4:v]scale=200:-1[v4];[5:v]scale=50:-1[v5];[v4][v5]overlay=(W-w)-5:(H-h)-5[vScreenCam];[vScreenCam][3:v]overlay=5:5[v]" -map "[v]" -map "[aMix]" -ac 1 -ar 11025 -c:a libmp3lame -r 1 -c:v libx264 -b:v 100k -b:a 10k -f flv rtmp://live.twitch.tv/app/live_674912043_oAwGnACTndHyeZnlA6scLegm8gaxwf
ffmpeg -stream_loop -1 -i 9stream.wav -f dshow -i audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5B4DB0B5-B645-4AFA-930D-4710AAF753DB}" -f dshow -i audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{ADECEC1D-C3CC-4BAE-8516-752251B8B63F}" -i camera.png -f gdigrab -framerate 1 -i desktop -f dshow -framerate 15 -i video="USB2.0 PC CAMERA" -filter_complex "[0:a]volume=2[a0];[1:a]volume=1.5[a1];[2:a]volume=1.5[a2];[a0][a1][a2]amix=inputs=3[aMix];[4:v]scale=200:-1[v4];[5:v]scale=50:-1[v5];[v4][v5]overlay=(W-w)-5:(H-h)-5[vScreenCam];[vScreenCam][3:v]overlay=5:5[v]" -map "[v]" -map "[aMix]" -ac 1 -ar 11025 -c:a libmp3lame -r 1 -c:v libx264 -b:v 100k -b:a 10k -f flv rtmp://live.twitch.tv/app/live_674912043_oAwGnACTndHyeZnlA6scLegm8gaxwf
ffmpeg version git-2020-08-02-b48397e Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.1 (GCC) 20200726
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 57.100 / 56. 57.100
  libavcodec     58. 99.100 / 58. 99.100
  libavformat    58. 49.100 / 58. 49.100
  libavdevice    58. 11.101 / 58. 11.101
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '9stream.wav':
  Metadata:
    encoder         : Lavf58.49.100
  Duration: 00:00:13.48, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, dshow, from 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5B4DB0B5-B645-4AFA-930D-4710AAF753DB}':
  Duration: N/A, start: 209609.948000, bitrate: 1411 kb/s
    Stream #1:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, dshow, from 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{ADECEC1D-C3CC-4BAE-8516-752251B8B63F}':
  Duration: N/A, start: 209610.502000, bitrate: 1411 kb/s
    Stream #2:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Input #3, png_pipe, from 'camera.png':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: png, rgba(pc), 32x32 [SAR 3779:3779 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
[gdigrab @ 0000009a3f019700] Capturing whole desktop as 1280x1024x32 at (0,0)
[gdigrab @ 0000009a3f019700] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #4, gdigrab, from 'desktop':
  Duration: N/A, start: 1618506176.140738, bitrate: 41943 kb/s
    Stream #4:0: Video: bmp, bgra, 1280x1024, 41943 kb/s, 1 fps, 1000k tbr, 1000k tbn, 1000k tbc
Input #5, dshow, from 'video=USB2.0 PC CAMERA':
  Duration: N/A, start: 209613.583000, bitrate: N/A
    Stream #5:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 15 fps, 15 tbr, 10000k tbn, 10000k tbc
[dshow @ 0000009a3f034900] real-time buffer [USB2.0 PC CAMERA] [video input] too full or near too full (101% of size: 3041280 [rtbufsize parameter])! frame dropped!
    Last message repeated 9 times
Stream mapping:
  Stream #0:0 (pcm_s16le) -> volume
  Stream #1:0 (pcm_s16le) -> volume
  Stream #2:0 (pcm_s16le) -> volume
  Stream #3:0 (png) -> overlay:overlay
  Stream #4:0 (bmp) -> scale
  Stream #5:0 (rawvideo) -> scale
  overlay -> Stream #0:0 (libx264)
  amix -> Stream #0:1 (libmp3lame)
Press [q] to stop, [?] for help
[dshow @ 0000009a3efd5b80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[dshow @ 0000009a406fb280] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[libx264 @ 0000009a4082ddc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 0000009a4082ddc0] profile High, level 1.1, 4:2:0, 8-bit
[libx264 @ 0000009a4082ddc0] 264 - core 161 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=5 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=100 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://live.twitch.tv/app/live_streamingKey':
  Metadata:
    encoder         : Lavf58.49.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p(progressive), 200x160, q=-1--1, 100 kb/s, 1 fps, 1k tbn, 1 tbc (default)
    Metadata:
      encoder         : Lavc58.99.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/100000 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 11025 Hz, mono, fltp, 10 kb/s (default)
    Metadata:
      encoder         : Lavc58.99.100 libmp3lame
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    1 fps=1.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    1 fps=0.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    3 fps=1.5 q=0.0 size=       0kB time=00:00:03.08 bitrate=   1.0kbits/sframe=    4 fps=1.6 q=0.0 size=       0kB time=00:00:03.66 bitrate=   0.8kbits/sframe=    4 fps=1.3 q=0.0 size=       0kB time=00:00:03.66 bitrate=   0.8kbits/sframe=    5 fps=1.4 q=0.0 size=       0kB time=00:00:04.65 bitrate=   0.7kbits/sframe=    5 fps=1.2 q=0.0 size=       0kB time=00:00:04.65 bitrate=   0.7kbits/sframe=    6 fps=1.3 q=0.0 size=       0kB time=00:00:05.64 bitrate=   0.5kbits/sframe=    6 fps=1.2 q=0.0 size=       0kB time=00:00:05.64 bitrate=   0.5kbits/sframe=    7 fps=1.3 q=0.0 size=       0kB time=00:00:06.64 bitrate=   0.5kbits/sframe=    7 fps=1.2 q=0.0 size=       0kB time=00:00:06.64 bitrate=   0.5kbits/sframe=    8 fps=1.2 q=0.0 size=       0kB time=00:00:07.58 bitrate=   0.4kbits/sframe=    8 fps=1.1 q=0.0 size=       0kB time=00:00:07.58 bitrate=   0.4kbits/sframe=    9 fps=1.2 q=0.0 size=       0kB time=00:00:08.57 bitrate=   0.4kbits/sframe=    9 fps=1.1 q=0.0 size=       0kB time=00:00:08.57 bitrate=   0.4kbits/sframe=   10 fps=1.2 q=0.0 size=       0kB time=00:00:09.56 bitrate=   0.3kbits/sframe=   10 fps=1.1 q=0.0 size=       0kB time=00:00:09.56 bitrate=   0.3kbits/sframe=   11 fps=1.1 q=0.0 size=       1kB time=00:00:10.55 bitrate=   0.9kbits/sframe=   11 fps=1.1 q=0.0 size=       1kB time=00:00:10.55 bitrate=   0.9kbits/sframe=   12 fps=1.1 q=0.0 size=       2kB time=00:00:11.55 bitrate=   1.7kbits/sframe=   12 fps=1.1 q=0.0 size=       2kB time=00:00:11.55 bitrate=   1.7kbits/sframe=   13 fps=1.1 q=0.0 size=       4kB time=00:00:12.59 bitrate=   2.5kbits/sframe=   13 fps=1.1 q=0.0 size=       4kB time=00:00:12.59 bitrate=   2.5kbits/sframe=   14 fps=1.1 q=0.0 size=       5kB time=00:00:13.58 bitrate=   3.0kbits/sframe=   14 fps=1.1 q=0.0 size=       5kB time=00:00:13.58 bitrate=   3.0kbits/sframe=   15 fps=1.1 q=0.0 size=       6kB time=00:00:14.58 bitrate=   3.5kbits/sframe=   15 fps=1.1 q=0.0 size=       6kB time=00:00:14.58 bitrate=   3.5kbits/sframe=   16 fps=1.1 q=0.0 size=       8kB time=00:00:15.57 bitrate=   4.0kbits/sframe=   16 fps=1.1 q=0.0 size=       8kB time=00:00:15.57 bitrate=   4.0kbits/sframe=   17 fps=1.1 q=0.0 size=       9kB time=00:00:16.56 bitrate=   4.4kbits/sframe=   17 fps=1.1 q=0.0 size=       9kB time=00:00:16.56 bitrate=   4.4kbits/sframe=   18 fps=1.1 q=0.0 size=      10kB time=00:00:17.55 bitrate=   4.7kbits/sframe=   18 fps=1.0 q=0.0 size=      10kB time=00:00:17.55 bitrate=   4.7kbits/sframe=   19 fps=1.1 q=0.0 size=      11kB time=00:00:18.55 bitrate=   5.0kbits/sframe=   19 fps=1.0 q=0.0 size=      11kB time=00:00:18.55 bitrate=   5.0kbits/sframe=   20 fps=1.1 q=0.0 size=      13kB time=00:00:19.54 bitrate=   5.3kbits/sframe=   20 fps=1.0 q=0.0 size=      13kB time=00:00:19.54 bitrate=   5.3kbits/sframe=   21 fps=1.1 q=0.0 size=      14kB time=00:00:20.58 bitrate=   5.6kbits/sframe=   21 fps=1.0 q=0.0 size=      14kB time=00:00:20.58 bitrate=   5.6kbits/sframe=   22 fps=1.1 q=0.0 size=      15kB time=00:00:21.58 bitrate=   5.8kbits/sframe=   22 fps=1.0 q=0.0 size=      15kB time=00:00:21.58 bitrate=   5.8kbits/sframe=   23 fps=1.1 q=0.0 size=      17kB time=00:00:22.57 bitrate=   6.0kbits/sframe=   23 fps=1.0 q=0.0 size=      17kB time=00:00:22.57 bitrate=   6.0kbits/sframe=   24 fps=1.1 q=0.0 size=      18kB time=00:00:23.56 bitrate=   6.2kbits/sframe=   24 fps=1.0 q=0.0 size=      18kB time=00:00:23.56 bitrate=   6.2kbits/sframe=   25 fps=1.1 q=0.0 size=      19kB time=00:00:24.56 bitrate=   6.4kbits/sframe=   25 fps=1.0 q=0.0 size=      19kB time=00:00:24.56 bitrate=   6.4kbits/sframe=   26 fps=1.1 q=0.0 size=      20kB time=00:00:25.55 bitrate=   6.5kbits/sframe=   26 fps=1.0 q=0.0 size=      20kB time=00:00:25.55 bitrate=   6.5kbits/sframe=   27 fps=1.0 q=0.0 size=      22kB time=00:00:26.54 bitrate=   6.7kbits/sframe=   27 fps=1.0 q=0.0 size=      22kB time=00:00:26.54 bitrate=   6.7kbits/sframe=   28 fps=1.0 q=0.0 size=      23kB time=00:00:27.58 bitrate=   6.8kbits/sframe=   28 fps=1.0 q=0.0 size=      23kB time=00:00:27.58 bitrate=   6.8kbits/sframe=   29 fps=1.0 q=0.0 size=      24kB time=00:00:28.58 bitrate=   6.9kbits/sframe=   30 fps=1.1 q=0.0 size=      25kB time=00:00:29.00 bitrate=   7.0kbits/sframe=   30 fps=1.0 q=0.0 size=      25kB time=00:00:29.57 bitrate=   7.0kbits/sframe=   30 fps=1.0 q=0.0 size=      25kB time=00:00:29.57 bitrate=   7.0kbits/sframe=   31 fps=1.0 q=0.0 size=      27kB time=00:00:30.56 bitrate=   7.2kbits/sframe=   32 fps=1.1 q=0.0 size=      27kB time=00:00:30.56 bitrate=   7.2kbits/sframe=   32 fps=1.0 q=0.0 size=      28kB time=00:00:31.56 bitrate=   7.3kbits/sframe=   33 fps=1.1 q=0.0 size=      29kB time=00:00:32.55 bitrate=   7.4kbits/sframe=   33 fps=1.0 q=0.0 size=      29kB time=00:00:32.55 bitrate=   7.4kbits/sframe=   33 fps=1.0 q=0.0 size=      29kB time=00:00:32.55 bitrate=   7.4kbits/sframe=   34 fps=1.0 q=0.0 size=      31kB time=00:00:33.54 bitrate=   7.4kbits/sframe=   35 fps=1.1 q=0.0 size=      31kB time=00:00:33.96 bitrate=   7.5kbits/sframe=   35 fps=1.0 q=0.0 size=      32kB time=00:00:34.53 bitrate=   7.5kbits/sframe=   36 fps=1.0 q=0.0 size=      33kB time=00:00:35.58 bitrate=   7.6kbits/sframe=   36 fps=1.0 q=0.0 size=      33kB time=00:00:35.58 bitrate=   7.6kbits/sframe=   36 fps=1.0 q=0.0 size=      33kB time=00:00:35.58 bitrate=   7.6kbits/sframe=   37 fps=1.0 q=0.0 size=      34kB time=00:00:36.57 bitrate=   7.7kbits/sframe=   38 fps=1.0 q=0.0 size=      36kB time=00:00:37.56 bitrate=   7.8kbits/sframe=   38 fps=1.0 q=0.0 size=      36kB time=00:00:37.56 bitrate=   7.8kbits/sframe=   39 fps=1.0 q=0.0 size=      37kB time=00:00:38.56 bitrate=   7.8kbits/sframe=   39 fps=1.0 q=0.0 size=      37kB time=00:00:38.56 bitrate=   7.8kbits/sframe=   40 fps=1.0 q=0.0 size=      38kB time=00:00:39.55 bitrate=   7.9kbits/sframe=   40 fps=1.0 q=0.0 size=      38kB time=00:00:39.55 bitrate=   7.9kbits/sframe=   41 fps=1.0 q=0.0 size=      39kB time=00:00:40.54 bitrate=   8.0kbits/sframe=   41 fps=1.0 q=0.0 size=      39kB time=00:00:40.54 bitrate=   8.0kbits/sframe=   42 fps=1.0 q=0.0 size=      41kB time=00:00:41.59 bitrate=   8.0kbits/sframe=   42 fps=1.0 q=0.0 size=      41kB time=00:00:41.59 bitrate=   8.0kbits/sframe=   43 fps=1.0 q=0.0 size=      42kB time=00:00:42.58 bitrate=   8.1kbits/sframe=   43 fps=1.0 q=0.0 size=      42kB time=00:00:42.58 bitrate=   8.1kbits/sframe=   44 fps=1.0 q=0.0 size=      43kB time=00:00:43.57 bitrate=   8.1kbits/sframe=   44 fps=1.0 q=0.0 size=      43kB time=00:00:43.57 bitrate=   8.1kbits/sframe=   45 fps=1.0 q=0.0 size=      45kB time=00:00:44.56 bitrate=   8.2kbits/sframe=   45 fps=1.0 q=0.0 size=      45kB time=00:00:44.56 bitrate=   8.2kbits/sframe=   46 fps=1.0 q=0.0 size=      46kB time=00:00:45.56 bitrate=   8.2kbits/sframe=   46 fps=1.0 q=0.0 size=      46kB time=00:00:45.56 bitrate=   8.2kbits/sframe=   47 fps=1.0 q=0.0 size=      47kB time=00:00:46.55 bitrate=   8.3kbits/sframe=   47 fps=1.0 q=0.0 size=      47kB time=00:00:46.55 bitrate=   8.3kbits/sframe=   48 fps=1.0 q=0.0 size=      48kB time=00:00:47.54 bitrate=   8.3kbits/sframe=   48 fps=1.0 q=0.0 size=      48kB time=00:00:47.54 bitrate=   8.3kbits/sframe=   49 fps=1.0 q=0.0 size=      50kB time=00:00:48.59 bitrate=   8.4kbits/sframe=   49 fps=1.0 q=0.0 size=      50kB time=00:00:48.59 bitrate=   8.4kbits/s[flv @ 0000009a40865940] Packets poorly interleaved, failed to avoid negative timestamp -3900 in stream 0.
Try -max_interleave_delta 0 as a possible workaround.
[flv @ 0000009a40865940] Packets are not in the proper order with respect to DTS
av_interleaved_write_frame(): Invalid argument
[flv @ 0000009a40865940] Failed to update header with correct duration.
[flv @ 0000009a40865940] Failed to update header with correct filesize.
frame=   50 fps=1.0 q=6.0 Lsize=      63kB time=00:00:49.11 bitrate=  10.5kbits/s speed=   1x
video:27kB audio:48kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0000009a4082ddc0] frame I:1     Avg QP: 0.56  size: 27197
[libx264 @ 0000009a4082ddc0] frame P:15    Avg QP: 0.76  size:  2567
[libx264 @ 0000009a4082ddc0] frame B:34    Avg QP: 3.98  size:  1481
[libx264 @ 0000009a4082ddc0] consecutive B-frames:  8.0%  0.0% 12.0% 80.0%
[libx264 @ 0000009a4082ddc0] mb I  I16..4: 13.1% 13.8% 73.1%
[libx264 @ 0000009a4082ddc0] mb P  I16..4:  0.0%  0.1%  0.8%  P16..4: 17.5%  5.9%  4.2%  0.0%  0.0%    skip:71.5%
[libx264 @ 0000009a4082ddc0] mb B  I16..4:  0.0%  0.0%  0.3%  B16..8: 12.1%  4.2%  2.4%  direct: 6.3%  skip:74.7%  L0:42.9% L1:41.8% BI:15.4%
[libx264 @ 0000009a4082ddc0] final ratefactor: -7.50
[libx264 @ 0000009a4082ddc0] 8x8 transform intra:12.3% inter:14.5%
[libx264 @ 0000009a4082ddc0] coded y,uvDC,uvAC intra: 95.2% 96.9% 96.9% inter: 16.0% 14.9% 14.8%
[libx264 @ 0000009a4082ddc0] i16 v,h,dc,p: 26% 32% 32% 11%
[libx264 @ 0000009a4082ddc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8% 40% 14%  8%  1%  2%  1%  1% 25%
[libx264 @ 0000009a4082ddc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 45%  7%  4%  5%  3%  7%  3%  9%
[libx264 @ 0000009a4082ddc0] i8c dc,h,v,p: 36% 40% 18%  6%
[libx264 @ 0000009a4082ddc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000009a4082ddc0] ref P L0: 65.2%  2.2% 19.9% 12.7%
[libx264 @ 0000009a4082ddc0] ref B L0: 71.8% 23.0%  5.2%
[libx264 @ 0000009a4082ddc0] ref B L1: 88.2% 11.8%
[libx264 @ 0000009a4082ddc0] kb/s:17.86
Conversion failed!


    


    Main message from above was :

    


    [flv @ 0000009a40865940] Packets poorly interleaved, failed to avoid negative timestamp -3900 in stream 0.


    


    It was problem to stream 0 so it was mixed sounds stream BUT earlier it was fine with mixing

    


    and sending mix over internet BUT after I added screen view and scaling it failed to work.

    


    What is problem ?

    


    How to fix it ?

    


    Since I was able to do this to stream to disc I would assume that

    


    computer processing power is enough. Since I was able to stream over internet mixed sounds I

    


    would assume that it is not problem here. So the problem must be with sending

    


    screen view. BUT I put framerate 1 per second and downsized its resolution. I compressed

    


    sounds as much as I could. I added -b:a and -b:v commands to reduce network flow.

    


    WHAT ELSE COULD I DO TO FIX IT ?

    


  • Privacy-friendly analytics : The benefits of an ethical, GDPR-compliant platform

    13 juin, par Joe

    Your visitors shouldn’t feel like you’re spying on them — even if you’re just trying to improve the user experience or track your marketing efforts. 

    While many analytics platforms make customers feel that way thanks to intrusive cookie consent banners and highly personalised ads, there is a growing movement towards ethical, privacy-friendly analytics.

    In this article, you’ll learn what privacy-friendly analytics is, why it matters, what to look for in a solution and which of the leading providers is right for you. 

    What is privacy-friendly analytics ? 

    Privacy-friendly analytics is a form of website analytics that collects and analyses data in a way that respects the user’s privacy. It’s a type of ethical web analytics.

    Privacy-friendly platforms limit personal data collection and anonymise individual user data while being transparent about collection and tracking methods. They help companies adhere to data protection laws (like GDPR, CCPA, and HIPAA) and new privacy laws (like OCPA, FDBR, and TDPSA) without configuring custom settings. 

    Why use privacy-friendly analytics ? 

    Millions of businesses choose privacy-friendly analytics platforms like Matomo. Here are a few reasons why : 

    Build trust with customers

    Research shows that the vast majority of consumers don’t trust companies with their data, believing that they prioritise profits over data protection. 

    Privacy-friendly analytics can help businesses prove they aren’t out to profit from consumer data and regain customer trust. This can ultimately boost revenue. According to Cisco’s Data Privacy Benchmark Study, organisations gain $180 for every $100 spent on privacy. 

    Comply with privacy regulations

    Data privacy regulations, such as GDPR, protect consumer privacy and establish strict rules governing how businesses can collect and use personal data.

    The cost of non-compliance is high. Under GDPR, fines can be up to €20 million, or 4% of worldwide annual revenue.

    Thanks to features like data anonymisation and the default use of first-party cookies, privacy-friendly analytics platforms can support and strengthen compliance efforts. 

    In fact, the French Data Protection Authority (CNIL) approved Matomo as one of the only web analytics tools to collect data without tracking consent.

    Minimise the impact of a breach

    According to IBM’s Cost of a Data Breach report, the average cost of a data breach is nearly $4.5 million. The more personally identifiable information (PII) is involved, the higher the fines and penalties. 

    A privacy-friendly analytics tool can reduce the potential impact of a breach by minimising the amount of personal information you hold. 

    Is Google Analytics privacy-friendly ?

    Google may be the best-known analytics platform, but it’s not the best choice for businesses that want to collect data responsibly and ethically. 

    Here are just a few of Google Analytics’s privacy issues :

    • It uses analytics data to run its advertising business.
    • It may train large language models like Gemini with analytics data.
    • It requires a specific setup to be GDPR compliant that isn’t available out of the box.

    Google Analytics’s ongoing issues with privacy laws like GDPR also raise doubt. The French and Austrian Data Protection Authorities have banned Google Analytics in the past, and there is no guarantee they won’t do so again. 

    What to look for in privacy-friendly analytics ?

    Several privacy-friendly analytics tools are available. To find the right one for your brand, look for the following features.

    Data ownership

    Choose a provider that gives you as much control over your users’ data as possible. Ideally, this will be via an on-site solution where you store data on your servers. For cloud-based options, ensure your analytics provider can’t access, use or sell it.

    With 100% data ownership, you have the power to protect your users’ privacy. You know where your customer data is stored and what’s happening to it without external influence.

    Open source

    The only genuinely privacy-friendly software is open-source software. Open-source software means anyone can review the code to ensure it does what it promises — in this case, maximising privacy. 

    Matomo is an open-source software company. Our source code is on GitHub, where everyone can see precisely how our platform tracks and stores user data. A community of developers also regularly examines and reviews our code to further strengthen security. 

    Data anonymisation 

    Privacy-friendly analytics should allow marketers to completely anonymise the data they collect. They achieve this through several techniques like IP anonymisation and pseudonymised user IDs that modify or remove personally identifiable data so it can’t be linked to individuals.

    Data anonymisation settings Matomo

    Matomo’s data anonymisation settings 

    In Matomo, for example, you can anonymise the following things in the platform’s Privacy settings :

    • IP address
    • Location
    • User ID

    IP address anonymisation is enabled by default in Matomo.

    No data sampling 

    Data sampling involves extrapolating analytics reports from an incomplete data set. Google Analytics uses this practice and relies on estimates, leading to incomplete and potentially inaccurate results.

    Privacy-friendly analytics should provide 100% accurate insights without making assumptions about your users’ data.

    GDPR compliance

    Privacy-friendly web analytics platforms adhere to even the strictest privacy laws, including GDPR, HIPAA and CCPA, thanks to the following features :

    • Data anonymisation
    • Cookieless tracking
    • EU data storage
    • First-party cookies by default
    Data subject access request setting Matomo

    Matomo data subject access request settings
    (Image Source)

    Privacy-first platforms also make it easy for companies to fulfil data subject access requests. In Matomo, for example, a dedicated feature lets you find, download and delete all of the data you hold about specific individuals. 

    Cookieless tracking

    Cookieless tracking is a form of visitor tracking that uses methods other than cookies to identify individual users. It is more privacy-friendly because no personal data is collected, and users can withhold consent from cookie banners.

    Matomo uses the most privacy-friendly industry-leading cookieless tracking method, config_id, to anonymously track visitors without fingerprinting them. 

    Top 3 privacy-friendly analytics platforms

    We’ve shortlisted three of the leading privacy-friendly analytics platforms. Learn what they offer, what makes them different and how much they cost.

    Matomo

    Matomo is an open-source web analytics tool and privacy-focused Google Analytics alternative trusted by over one million sites in over 190 countries and over 50 languages. 

    Matomo dashboard

    Matomo dashboard

    Matomo prioritises privacy and keeping businesses compliant with global privacy regulations like GDPR, CCPA and HIPAA. The data you collect is 100% accurate and yours alone. We don’t share it or use it for other purposes. 

    Benefits

    • Matomo’s all-in-one solution offers traditional web and behavioural analytics, such as heatmaps and session recordings. It also includes a free, open-source tag manager
    • Matomo gives you the choice of where to store your user’s data. With Matomo Cloud, that’s in our European servers. With Matomo On-Premise, that’s on your servers.
    • Matomo is open-source. Hundreds of independent developers have reviewed our code, and you can view it yourself on GitHub.

    Pricing 

    Hosting Matomo On-Premise is free, while Matomo Cloud costs $26 per month. 

    Fathom

    Fathom Analytics is a simple, easy-to-use alternative to Google Analytics that puts a premium on privacy. 

    Fathom dashboard

    Fathom dashboard
    (Image Source)

    Fathom has made its platform as easy to use as possible. You can install Fathom on any website or CMS using a single line of code. It also means the platform won’t massively impact your site’s speed or SEO performance. 

    Benefits

    • Fathom complies with all major privacy regulations, including GDPR and CCPA.
    • Fathom doesn’t sample data. It also blocks bots and scrapers, so you only see human visitors.
    • Fathom anonymises IP addresses, so you don’t have to show cookie banners.

    Drawbacks

    • Fathom doesn’t offer many of Matomo’s advanced features like e-commerce tracking, heatmaps, and session recordings.
    • The premium version of Fathom is not open-source. 

    Pricing 

    From $15 per month.

    Plausible

    Plausible Analytics is an open-source, privacy-friendly analytics tool built and hosted in the EU.

    Plausible dashboard

    Plausible dashboard
    (Image Source)

    The platform launched in 2019 as a lightweight, easy-to-use alternative to Google Analytics. Its simplicity is a big selling point. Instead of dozens of menus, it presents the information you need on a single page.

    Benefits

    • Plausible boasts an ultra-lightweight script, which means it has a minimal impact on page loading times. 
    • Plausible is GDPR and CCPA-compliant by design, so there’s no need for cookie banners.
    • Plausible is an open-source software with the source code available on GitHub.

    Drawbacks

    • Plausible lacks advanced privacy controls like a GDPR manager.
    • It has none of Matomo’s advanced features like A/B testing, session recordings or heatmaps. 

    Pricing 

    From $9 per month

    Try Matomo for free

    Ready to try a privacy-friendly analytics solution ? Making the switch is easy with Matomo, as it’s one of the only platforms to import historical Google Analytics data. You can also try Matomo for free for 21 days — no credit card required. 

  • Issues with processing media on windows Azure

    23 septembre 2015, par Ahmed Mujtaba

    I have a website built on ASP.NET web forms that works as a media portal for users to upload videos. I’m using ffmpeg encoders to produce video contents to be streamed in the browser. I’m using the web deploy method to publish the site on the Azure server. The website get’s deployed properly however I get following issues in the live site.

    1. Video never get’s encoded and published. I get some sort of error.

    2. Video get’s published but the process of uploading and encoding the video is way too slow on the web server.

    My project solution contains upload.ashx that handles the upload requests and makes the call to encode.ashx which is responsible for the encoding and publishing of the videos. I tried to remotely debug the site but the debugger never get’s to encode.ashx.

    I was wondering if these issues can be resolved by having the website deployed with a VM ?

    Script that uploads the video file :

    var filesuploaded = 0;
       var faileduploaded = 0;

       $(function () {
           var uploader = new plupload.Uploader({
               runtimes: 'gears,html5,flash,silverlight,browserplus',
               browse_button: '<%= pickfiles.ClientID %>',
               container: 'container',
               max_file_size: '<%= MaxMediaSize %>mb',
               url: '<%=Config.GetUrl() %>videos/upload/upload.ashx',
               flash_swf_url: '<%=Config.GetUrl() %>plupload/js/plupload.flash.swf',
               silverlight_xap_url: '<%=Config.GetUrl() %>plupload/js/plupload.silverlight.xap',
               chunk_size: '4mb',
               <%= UniqueNames %>
               filters: [
               { title: '<%= AllowedFormatsDisplay %>', extensions: '<%= AllowedFormats %>'}],
               headers: { UName: '<%=UserName %>', MTP: '<%= MediaType %>' }
           });
           //uploader.bind('Init', function (up, params) {
           //    $('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
           //});

           uploader.init();

           $('#uploadfiles').click(function (e) {
               uploader.start();
               e.preventDefault();
               $("#uploadfiles").hide();
               $("#&lt;%= embd.ClientID %>").hide();
           });

           uploader.bind('FilesAdded', function (up, files) {
               $("#uploadfiles").show();
               $("#&lt;%= msg.ClientID %>").html("");
               var count=0;
               $.each(files, function (i, file) {
                   $('#filelist').append(
                       '<div class="item_pad_4 bx_br_bt">' + (count + 1) + ': ' + file.name + ' (' + plupload.formatSize(file.size) + ')  <b></b></div>' );
                   count++;
               });
               var maxupload = &lt;%= MaxVideoUploads %>;
               if(count > maxupload)
               {              
                   $.each(files, function(i, file) {
                       uploader.removeFile(file);
                   });

                   $('#filelist').html("");
                   $("#uploadfiles").hide();
                   Display_Message("#&lt;%= msg.ClientID %>", "Can't upload more than " + maxupload + " records at once!", 1, 1);
                   return false;
               }
               else {
                   $("#tfiles").html(count);
                   $("#uploadfiles").removeClass("disabled");
                   $("#&lt;%= pickfiles.ClientID %>").hide();
               }
               up.refresh(); // Reposition Flash/Silverlight
           });

           uploader.bind('UploadProgress', function (up, file) {
               $('#' + file.id + " b").html(file.percent + "%");
           });

           uploader.bind('Error', function (up, err) {
               $('#filelist').append("<div>Error: " + err.code +
                   ", Message: " + err.message +
                   (err.file ? ", File: " + err.file.name : "") +
                   "</div>"
               );
               up.refresh(); // Reposition Flash/Silverlight
           });

           var failedstatus = 0;
           uploader.bind('FileUploaded', function (up, file, info) {
               // encode started
               if (info.response != "failed" &amp;&amp; info.response != "") {
                   EncodeVD(file.id, info.response, file.size);
                   Display_Message('#' + file.id, "Please wait for final processing", 0, 1);
                   if (failedstatus == 0)
                       Redirect(info.response);
                   filesuploaded++;
               }
               else {
                   Display_Message('#' + file.id, "Response is: " + info.response, 0, 1);
               }
           });
       });
       var redcnt = 0;
       function Redirect(filename) {
           var IntervalID = setInterval(function () {
               redcnt++;
               if (redcnt > 2) {
                   clearInterval(IntervalID);
                   var tfiles = $("#tfiles").html();
                   if(tfiles == faileduploaded) { // break further processing all videos failed to upload
                   }
                   else if (filesuploaded >= tfiles) {
                       document.location = "&lt;%=ConfirmPageUrl %>?fn=" + filename + "&amp;gid=&lt;%=GalleryID %>&amp;uvids=" + $("#tfiles").html() + "&amp;mpid=" + $("#maxpid").html().trim() + "&lt;%=GroupParam %>";
                   }
           }
           }, 2000);
    }
    function EncodeVD(mid, mfile, msize) {
       var params = '&lt;%= EncodingParams %>&amp;fn=' + mfile;
           $.ajax({
               type: 'GET',
               url: '&lt;%= Encoding_Handler_Path %>',
               data: params,
               async: true,
               success: function (msg) {
                   if (msg == "Success" || msg == "") {
                       $('#' + mid).html('<strong>Uploading Completed Successfully - Wait for Processing.');
                   }
                   else {
                       failedstatus = 1;
                       faileduploaded++;
                       Display_Message('#' + mid, "Response is: " + msg, 0, 1);
                   }
               }
           });
       }
    </strong>

    Server side code for processing the file upload :

    private int MediaType = 0; // 0 : video, 1: audio

       public void ProcessRequest (HttpContext context) {
           try
           {
               context.Response.ContentType = "text/plain";
               context.Response.Write(ProcessMedia(context));
           }
           catch (Exception ex)
           {
               context.Response.Write("error|" + ex.Message);
           }
       }

       public string ProcessMedia(HttpContext context)
       {
           if (context.Request.Files.Count > 0)
           {
               int chunk = context.Request["chunk"] != null ? int.Parse(context.Request["chunk"]) : 0;
               string fileName = context.Request["name"] != null ? context.Request["name"] : string.Empty;
               //string _fileName = fileName.Remove(fileName.LastIndexOf(".")) + "-" + Guid.NewGuid().ToString().Substring(0, 6) + "" + fileName.Remove(0, fileName.LastIndexOf("."));
               HttpPostedFile fileUpload = context.Request.Files[0];

               string upath = "";
               if (context.Request.Headers["UName"] != null)
                   upath = context.Request.Headers["UName"].ToString();

               //if (CloudSettings.EnableCloudStorage &amp;&amp; upath != "")
               //    _fileName = upath.Substring(0, 3) + "-" + _fileName; // avoid duplication in cloud storage

               if (context.Request.Headers["MTP"] != null)
                   MediaType = Convert.ToInt32(context.Request.Headers["MTP"]);

               //string extensions = "";
               //if (MediaType == 0)
               //    extensions = Site_Settings.Video_Allowed_Formats;
               //else
               //    extensions = Site_Settings.Audio_Allowed_Formats;

               //bool sts = UtilityBLL.Check_File_Extension(extensions, fileName.ToLower());
               //if (sts == false)
               //{
               //    return "Invalid format, please upload proper video!"; // Invalid video format, please upload proper video
               //}

               int allowable_size_mb = 0;
               if (MediaType == 0)
               {
                   allowable_size_mb = Site_Settings.Video_Max_Size;
               }
               else
               {
                   allowable_size_mb = Site_Settings.Audio_Max_Size;
               }
               int UploadSize = allowable_size_mb * 1000000;
               if (fileUpload.ContentLength > UploadSize)
               {
                   return "Video Limit Exceeds";
               }

               string uploadPath = "";
               // check whether audio / mp3 encoding enabled
               if (this.MediaType == 1)
               {
                   // audio encoding
                   if (fileName.EndsWith(".mp3"))
                   {
                       // upload mp3 directly in mp3 path instead of default path
                       if (upath == "")
                           uploadPath = UrlConfig.MP3_Path(); // source video path
                       else
                           uploadPath = UrlConfig.MP3_Path(upath); // source video path
                   }
                   else
                   {
                       // default path
                       if (upath == "")
                           uploadPath = UrlConfig.Source_Video_Path(); // source video path
                       else
                           uploadPath = UrlConfig.Source_Video_Path(upath); // source video path
                   }
               }
               else
               {//azure
                   // default path
                   if (upath == "")
                       uploadPath = UrlConfig.Source_Video_Path(); // source video path
                   else
                       uploadPath = UrlConfig.Source_Video_Path(upath); // source video path
               }

               FileStream fs;
               using (fs = new FileStream(Path.Combine(uploadPath, fileName), chunk == 0 ? FileMode.Create : FileMode.Append))
               {
                   byte[] buffer = new byte[fileUpload.InputStream.Length];
                   fileUpload.InputStream.Read(buffer, 0, buffer.Length);

                   fs.Write(buffer, 0, buffer.Length);
               }
               return fileName; // "Success";
           }
           else
           {
               return "failed";
           }

           return "";
       }
       public bool IsReusable {
           get {
               return false;
           }
       }

    code in encode.aspx responsible for encoding the video :

    private string EncodeMedia(HttpContext context)
    {
       string sourcepath = "";
       string publishedpath = "";
       string mp3path = "";
       string thumbpath = "";
       if (this.UserName != "")
       {//azure
           sourcepath = UrlConfig.Source_Video_Path(this.UserName);
           publishedpath = UrlConfig.Published_Video_Path(this.UserName);
           mp3path = UrlConfig.MP3_Path(this.UserName);
           thumbpath = UrlConfig.Thumbs_Path(this.UserName);
       }
       else
       {
           sourcepath = UrlConfig.Source_Video_Path();
           publishedpath = UrlConfig.Published_Video_Path();
           mp3path = UrlConfig.MP3_Path();
           thumbpath = UrlConfig.Thumbs_Path();
       }
       if (this.FileName.EndsWith(".mp3") &amp;&amp; this.MediaType == 1)
       {
           // mp3 and audio format
           if (!File.Exists(mp3path + "/" + this.FileName))
           {
               return "Audio file not found!";
           }
       }
       else
       {
           // rest normal video and audio encoding
           if (!File.Exists(sourcepath + "/" + this.FileName))
           {
               return "Source file not found!";
           }
       }

       if (CloudSettings.EnableCloudStorage &amp;&amp; this.UserName != "")
           this.FileName = this.UserName.Substring(0, 3) + "-" + this.FileName; // avoid duplication in cloud storage


       //double f_contentlength = 0;
       //if (Site_Settings.Feature_Packages == 1)
       //{
       //    if (Config.GetMembershipAccountUpgradeType() != 1)
       //    {
       //        // Check whether user have enough space to upload content
       //        // Restriction only for normal or premium users
       //        f_contentlength = (double)fileUpload.ContentLength / 1000000;
       //        string media_field_name = "space_video";
       //        if (MediaType == 1)
       //            media_field_name = "space_audio";
       //        if (!User_PackagesBLL.Check_User_Space_Status(upath, media_field_name, f_contentlength) &amp;&amp; !isAdmin)
       //        {
       //            // insufficient credits to upload content
       //            return "Insufficient credits to upload media file"; //   Response.Redirect(Config.GetUrl("myaccount/packages.aspx?status=" + media_field_name), true);
       //        }
       //    }
       //}

       this.backgroundpublishing = true; // should be true on direct encoding
       // Video Processing
       string flv_filename = "";
       string original_filename = "";
       string thumb_filename = "";
       string duration = "";
       int duration_sec = 0;

       // set video actions : 1 -> on, 0 -> off
       int isenabled = 1;
       int ispublished = 1;
       int isreviewed = 1;
       int isresponse = 0;
       if (Response_VideoID > 0)
           isresponse = 1;

       string flv_url = "none";
       string thumb_url = "none";
       string org_url = "none";
       string _embed = "";

       string errorcode = "0";
       VideoInfo info = null;

       if (Site_Settings.Content_Approval == 0)
           isreviewed = 0;


       // check whether audio / mp3 encoding enabled
       if (this.FileName.EndsWith(".mp3") &amp;&amp; this.MediaType==1)
       {
           // audio encoding
           // mp3 file already
           // so no encoding happens
           MediaHandler _minfo = new MediaHandler();
           _minfo.FFMPEGPath = Encoding_Settings.FFMPEGPATH;
           _minfo.FileName = FileName;
           _minfo.InputPath = mp3path;
           info = _minfo.Get_Info();

           flv_filename = FileName;
           original_filename = FileName;
           duration = info.Duration;
           duration_sec = info.Duration_Sec;
           isenabled = 1; // enabled
       }
       else if (this.directpublishing)
       {            

           // publish video
           ArrayList itags = new ArrayList();
           MHPEncoder encoder = new MHPEncoder();
           //if (this.FileName.EndsWith(".mpeg") || this.FileName.EndsWith(".mpg")) // use mpg compatible ffmpeg encoder
           //    encoder.FfmpegPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + "\\ffmpeg\\ffmpegbk\\ffmpeg.exe";
               //encoder.ThumbFfmpegPath = Encoding_Settings.FFMPEGPATH; // use normal ffmpeg encoder for thumbs processing

           //azure
           encoder.FfmpegPath = Encoding_Settings.FFMPEGPATH; // use normal ffmpeg encoder
           encoder.FlvToolPath = Encoding_Settings.FLVTOOLPATH; // set meta information for flv videos
           encoder.Mp4BoxPath = Encoding_Settings.MP4BoxPath; // set meta information for mp4 videos
           encoder.SourcePath = sourcepath;
           encoder.SourceFileName = this.FileName;

           // No cloud storage on direct encoding
           //if (CloudSettings.EnableCloudStorage)
           //    encoder.EnableCloudStorage = true;


           if (MediaType == 1)
           {
               // audio encoding
               itags.Add("14");
               encoder.iTags = itags;
               encoder.GrabThumbs = false;
               encoder.PublishedPath = mp3path;

               //_vprocess.OutputPath = this.MP3Path;
               //_vprocess.isAudio = true;
           }
           else
           {
               // video encoding
               itags.Add(EncoderSettings.DefaultITagValue.ToString()); // 5 for 360p mp4 encoding    
               //itags.Add(7);   // this will call 7 case settings to publish next video ending with _7.mp4 instead of _5.mp4
               // so there will be 2 videos with different resoultions published at the end of the process?
               // yesmake sure use proper settings first test it directly via command.    
               //okay i got it. But i'm gonna have to use a different media players to incroporate those settings
               // once published you can load different videos for different user by checking _7.mp4 (end) va
              //okay got it.

               //azure
               encoder.PublishedPath = publishedpath;
               encoder.iTags = itags;
               encoder.ThumbsDirectory = thumbpath;
               encoder.TotalThumbs = 15;

               //_vprocess.ThumbPath = this.ThumbPath;
               //_vprocess.OutputPath = this.FLVPath;
               //if (Config.isPostWaterMark())
               //{
               //    // script for posting watermark on video
               //    _vprocess.WaterMarkPath = Server.MapPath(Request.ApplicationPath) + "\\contents\\watermark";
               //    _vprocess.WaterMarkImage = "watermark.gif";

               //}
           }
           int deleteoption = Site_Settings.Video_Delete_Original;
           if (deleteoption == 1)
           {
               encoder.DeleteSource = true;
           }
           // background processing
           if (this.backgroundpublishing &amp;&amp; this.MediaType==0)
           {
               encoder.BackgroundProcessing = true;
               // get information from source video in order to store it in database
               MediaHandler _minfo = new MediaHandler();
               //if (this.FileName.EndsWith(".mpeg") || this.FileName.EndsWith(".mpg")) // use mpg compatible ffmpeg encoder
               //    encoder.FfmpegPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + "\\ffmpeg\\ffmpegbk\\ffmpeg.exe";
               //else
                   _minfo.FFMPEGPath = Encoding_Settings.FFMPEGPATH;

               _minfo.FileName = FileName;
               _minfo.InputPath = sourcepath;
               info = _minfo.Get_Info();
           }
           // encode video processing
           Video_Information vinfo = encoder.Process();
           if (vinfo.ErrorCode > 0)
           {
               errorcode = vinfo.ErrorCode.ToString();
               ErrorLgBLL.Add_Log("Encoding Failed Log", "", "encoding error: " + vinfo.ErrorCode.ToString() + "<br />Description: " + vinfo.ErrorDescription.ToString());
                //return vinfo.ErrorDescription;
           }
           // Double check validation
           // if published video exist
           // if thumb exist
           // then proceed further

           if (MediaType == 0)
           {
               if (!File.Exists(encoder.PublishedPath + "/" + vinfo.FLVVideoName))
               {
                   return "Video failed to published properly.";
               }
               if (!File.Exists(encoder.ThumbsDirectory + "/" + vinfo.ThumbFileName))
               {
                   return "Thumbs failed to grab from video properly.";
               }
           }
           else
           {
               if (vinfo.FLVVideoName == "")
               {
                   vinfo.FLVVideoName = this.FileName.Remove(this.FileName.LastIndexOf(".")) + "_14.mp3"; // mp3 file path name
               }
               if (!File.Exists(encoder.PublishedPath + "/" + vinfo.FLVVideoName))
               {
                   return "Audio failed to published properly.";
               }
           }
           // Now thumbs and video published, procceed for data processing
           // get information from vinfo object
           if (this.backgroundpublishing &amp;&amp; this.MediaType == 0)
           {
               string OutputFileName = this.FileName.Remove(this.FileName.LastIndexOf("."));
               flv_filename = OutputFileName + "_" + EncoderSettings.DefaultITagValue + "." + EncoderSettings.Return_Output_Extension(EncoderSettings.DefaultITagValue);
               original_filename = vinfo.OriginalVideoName;
               thumb_filename = OutputFileName + "_008.jpg"; // info.ThumbFileName;
               duration = info.Duration;
               duration_sec = info.Duration_Sec;
           }
           else
           {
               flv_filename = vinfo.FLVVideoName;
               original_filename = vinfo.OriginalVideoName;
               thumb_filename = vinfo.ThumbFileName;
               duration = vinfo.Duration;
               duration_sec = vinfo.Duration_Sec;
               isenabled = vinfo.isEnabled;
           }

           // No cloud storage on direct encoding.
           // Note cloude storage only works if background processing is disabled
           // Or works in cased of sheduled processing
           if (CloudSettings.EnableCloudStorage &amp;&amp; errorcode == "0")
           {
               flv_url = "amazon";
               org_url = "https://s3.amazonaws.com/" + CloudSettings.OriginalVideoBucketName + "/" + this.FileName;
               thumb_url = "https://s3.amazonaws.com/" + CloudSettings.ThumbsBucketName + "/" + thumb_filename;

           }

       }
       else
       {
           // set publishing status off.
           ispublished = 0;
           original_filename = this.FileName;
       }

       // Store video information in database
       string ipaddress = context.Request.ServerVariables["REMOTE_ADDR"].ToString();

       // Store media information in database
       Video_Struct vd = new Video_Struct();
       vd.CategoryID = 0; // store categoryname or term instead of category id
       vd.Categories = Categories;
       vd.UserName = UserName;
       vd.Title = "";
       vd.Description = "";
       vd.Tags = Tags;
       vd.Duration = duration;
       vd.Duration_Sec = duration_sec;
       vd.OriginalVideoFileName = original_filename;
       vd.VideoFileName = flv_filename;
       vd.ThumbFileName = thumb_filename;
       vd.isPrivate = Privacy;
       vd.AuthKey = PAuth;
       vd.isEnabled = isenabled;
       vd.Response_VideoID = Response_VideoID; // video responses
       vd.isResponse = isresponse;
       vd.isPublished = ispublished;
       vd.isReviewed = isreviewed;
       vd.FLV_Url = flv_url;
       vd.Thumb_Url = thumb_url;
       vd.Org_Url = org_url;
       vd.Embed_Script = _embed;
       vd.isExternal = 0; // website own video, 1: embed video
       vd.IPAddress = ipaddress;
       vd.Type = MediaType;
       vd.YoutubeID = "";
       vd.isTagsreViewed = 1;
       vd.Mode = 0; // filter videos based on website sections
       //vd.ContentLength = f_contentlength;
       vd.GalleryID = GID;
       vd.ErrorCode = Convert.ToInt32(errorcode);
       long videoid = VideoBLL.Process_Info(vd, false);

       // Process tags
       if (Tags != "")
       {
           int tag_type = 0; // represent videos
           if (MediaType == 1)
               tag_type = 4; // represent audio file
           TagsBLL.Process_Tags(Tags, tag_type, 0);
       }

       if (Response_VideoID > 0)
       {
           VideoBLL.Update_Responses(Response_VideoID);
       }

       return "Success";
    }