Recherche avancée

Médias (91)

Autres articles (88)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (7833)

  • VLC command line : RTSP to mp4 file (video + audio)

    8 février 2016, par Dmitriy Gerashenko

    Win 7 x64.

    When I watch this link in VLC player all is fine :

    rtsp ://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

    When I try to capture link to file and to display :

    • There is video without sound on display.
    • Created file is not playable.

    Command :

    vlc.exe -vvv "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov" --sout="#transcode{venc=ffmpeg,vcodec=mp4v,vfilter=canvas{width=800,height=600},aenc=ffmpeg{strict=-2},acodec=mp4a}:duplicate{dst=display,dst=standard{access=file,mux=mp4,dst=video.mp4}"

    There are some errors in log, for example : MPEG4GenericRTPSource Warning: Unknown or unsupported "mode": AAC-hbr. Is it cause of my problems ? How to solve my issue ?

    Complete log (from VLCJ) :

    cd C:\Users\gda\Documents\NetBeansProjects\Video; "JAVA_HOME=C:\\Program Files (x86)\\Java\\jdk1.8.0_71" cmd /c "\"\"C:\\Users\\gda\\AppData\\Roaming\\NetBeans\\8.0.2\\maven\\bin\\mvn.bat\" -Dexec.args=\"-classpath %classpath ru.cherezweb.app.video.Video\" -Dexec.executable=\"C:\\Program Files (x86)\\Java\\jdk1.8.0_71\\bin\\java.exe\" -Dmaven.ext.class.path=C:\\Users\\gda\\AppData\\Roaming\\NetBeans\\8.0.2\\maven-nblib\\netbeans-eventspy.jar -Dfile.encoding=UTF-8 process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
    Scanning for projects...

    ------------------------------------------------------------------------
    Building Video 1.0-SNAPSHOT
    ------------------------------------------------------------------------

    --- maven-resources-plugin:2.5:resources (default-resources) @ Video ---
    [debug] execute contextualize
    Using 'UTF-8' encoding to copy filtered resources.
    skip non existing resourceDirectory C:\Users\gda\Documents\NetBeansProjects\Video\src\main\resources

    --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Video ---
    Nothing to compile - all classes are up to date

    --- exec-maven-plugin:1.2.1:exec (default-cli) @ Video ---
    20:37:29.097 [main] INFO  uk.co.caprica.vlcj.Info - vlcj: 3.10.1
    20:37:29.101 [main] INFO  uk.co.caprica.vlcj.Info - java: 1.8.0_71 Oracle Corporation
    20:37:29.101 [main] INFO  uk.co.caprica.vlcj.Info - java home: C:\Program Files (x86)\Java\jdk1.8.0_71\jre
    20:37:29.101 [main] INFO  uk.co.caprica.vlcj.Info - os: Windows 10 10.0 x86
    20:37:29.103 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - discover()
    20:37:29.103 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - jnaLibraryPath=null
    20:37:29.103 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - discoveryStrategy=uk.co.caprica.vlcj.discovery.linux.DefaultLinuxNativeDiscoveryStrategy@176c05c
    20:37:29.104 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - supported=false
    20:37:29.104 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - discoveryStrategy=uk.co.caprica.vlcj.discovery.windows.DefaultWindowsNativeDiscoveryStrategy@1eb6432
    20:37:29.104 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - supported=true
    20:37:29.104 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - discover()
    20:37:29.105 [main] DEBUG u.c.c.v.r.windows.WindowsRuntimeUtil - getVlcInstallDir()
    20:37:29.430 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - directoryNames=[C:\Program Files (x86)\VideoLAN\VLC, C:\Users\gda\Documents\NetBeansProjects\Video, C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter, C:\Program Files (x86)\Intel\iCLS Client\, C:\Program Files\Intel\iCLS Client\, C:\PROGRAMDATA\ORACLE\JAVA\JAVAPATH, C:\Windows\SYSTEM32, C:\Windows, C:\Windows\SYSTEM32\WBEM, C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\, C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\DAL, C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\IPT, C:\PROGRAM FILES (X86)\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\DAL, C:\PROGRAM FILES (X86)\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\IPT, C:\Program Files\Intel\Intel(R) Management Engine Components\DAL, C:\Program Files\Intel\Intel(R) Management Engine Components\IPT, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL, C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT, C:\Program Files\WIDCOMM\Bluetooth Software\, C:\Program Files\WIDCOMM\Bluetooth Software\syswow64, C:\Program Files\TortoiseSVN\bin, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, C:\Program Files\OpenVPN\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\Program Files\TortoiseGit\bin, C:\Program Files (x86)\Skype\Phone\]
    20:37:29.430 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - directoryName=C:\Program Files (x86)\VideoLAN\VLC
    20:37:29.430 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - Matched 'libvlc.dll' in 'C:\Program Files (x86)\VideoLAN\VLC'
    20:37:29.430 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - Matched 'libvlccore.dll' in 'C:\Program Files (x86)\VideoLAN\VLC'
    20:37:29.430 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - Matched all required files
    20:37:29.430 [main] DEBUG u.c.c.v.d.AbstractNativeDiscoveryStrategy - result=C:\Program Files (x86)\VideoLAN\VLC
    20:37:29.430 [main] DEBUG u.c.c.vlcj.discovery.NativeDiscovery - path=C:\Program Files (x86)\VideoLAN\VLC
    20:37:29.431 [main] INFO  u.c.c.vlcj.discovery.NativeDiscovery - Discovery found libvlc at 'C:\Program Files (x86)\VideoLAN\VLC'
    true
    2.2.1 Terry Pratchett (Weatherwax)
    20:37:29.490 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - initX=null
    20:37:29.494 [main] INFO  u.c.c.vlcj.binding.LibVlcFactory - vlc: 2.2.1 Terry Pratchett (Weatherwax), changeset 2.2.1-0-ga425c42
    20:37:29.494 [main] INFO  u.c.c.vlcj.binding.LibVlcFactory - libvlc: C:\Program Files (x86)\VideoLAN\VLC\libvlc.dll
    20:37:29.494 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - MediaPlayerFactory(libvlc=Proxy interface to Native Library ,libvlcArgs=[])
    20:37:29.494 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - jna.library.path=null
    20:37:29.494 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - VLC_PLUGIN_PATH=null
    20:37:29.529 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - instance=native@0x1195650 (uk.co.caprica.vlcj.binding.internal.libvlc_instance_t@1195650)
    20:37:29.529 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - equalizerAvailable=true
    20:37:29.529 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - createEqualizerBandFrequencies()
    20:37:29.529 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - numBands=10
    20:37:29.530 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - result=[31.25, 62.5, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0]
    20:37:29.530 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - createEqualizerPresetNames()
    20:37:29.530 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - numPresets=18
    20:37:29.530 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - result=[Flat, Classical, Club, Dance, Full bass, Full bass and treble, Full treble, Headphones, Large Hall, Live, Party, Pop, Reggae, Rock, Ska, Soft, Soft rock, Techno]
    20:37:29.530 [main] DEBUG u.c.c.vlcj.player.MediaPlayerFactory - newHeadlessMediaPlayer()
    20:37:29.538 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - DefaultMediaPlayer(libvlc=Proxy interface to Native Library , instance=native@0x1195650 (uk.co.caprica.vlcj.binding.internal.libvlc_instance_t@1195650))
    20:37:29.538 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - createInstance()
    20:37:29.543 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - mediaPlayerInstance=native@0x16853ac4 (uk.co.caprica.vlcj.binding.internal.libvlc_media_player_t@16853ac4)
    20:37:29.544 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - mediaPlayerEventManager=native@0x16878818 (uk.co.caprica.vlcj.binding.internal.libvlc_event_manager_t@16878818)
    20:37:29.544 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - registerEventListener()
    20:37:29.546 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerMediaChanged
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerNothingSpecial
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerOpening
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerBuffering
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerPlaying
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.567 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerPaused
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerStopped
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerForward
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerBackward
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerEndReached
    20:37:29.568 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerEncounteredError
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerTimeChanged
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerPositionChanged
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerSeekableChanged
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerPausableChanged
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerTitleChanged
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.569 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerSnapshotTaken
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerLengthChanged
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerVout
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaPlayerScrambledChanged
    20:37:29.570 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.572 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - playMedia(mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov,mediaOptions=[:sout=#transcode{venc=ffmpeg,vcodec=mp4v,vfilter=canvas{width=800,height=600},aenc=ffmpeg{strict=-2},acodec=mp4a}:duplicate{dst=display,dst=standard{access=file,mux=mp4,dst=yahoo.m4v}}])
    20:37:29.573 [main] DEBUG u.c.c.v.player.MediaResourceLocator - encodeMrl(mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov)
    20:37:29.573 [main] DEBUG u.c.c.v.player.MediaResourceLocator - MRL does not contain any Unicode characters
    20:37:29.573 [main] DEBUG u.c.c.v.player.MediaResourceLocator - result=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - playMedia(media=SimpleMedia[mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov,mediaOptions=[Ljava.lang.String;@17c74e5])
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - prepareMedia(media=SimpleMedia[mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov,mediaOptions=[Ljava.lang.String;@17c74e5])
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - setMedia(media=SimpleMedia[mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov,mediaOptions=[Ljava.lang.String;@17c74e5])
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - createMediaInstance(media=SimpleMedia[mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov,mediaOptions=[Ljava.lang.String;@17c74e5])
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - Treating mrl as a location
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - mediaInstance=native@0x16876500 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@16876500)
    20:37:29.574 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - mediaOption=:sout=#transcode{venc=ffmpeg,vcodec=mp4v,vfilter=canvas{width=800,height=600},aenc=ffmpeg{strict=-2},acodec=mp4a}:duplicate{dst=display,dst=standard{access=file,mux=mp4,dst=yahoo.m4v}}
    20:37:29.575 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - registerMediaEventListener()
    20:37:29.575 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaMetaChanged
    20:37:29.575 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.575 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaSubItemAdded
    20:37:29.575 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaDurationChanged
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaParsedChanged
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaFreed
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaStateChanged
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - event=libvlc_MediaSubItemTreeAdded
    20:37:29.576 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=0
    20:37:29.585 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - mrl(mediaInstance=native@0x16876500 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@16876500))
    20:37:29.587 [pool-2-thread-1] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - mediaChanged(mediaPlayer=uk.co.caprica.vlcj.player.headless.DefaultHeadlessMediaPlayer@1727f27,media=native@0x16876500 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@16876500),mrl=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov)
    20:37:29.588 [pool-2-thread-1] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - Raising event for new media
    20:37:29.588 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - result=true
    20:37:29.588 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - play()
    20:37:29.593 [main] DEBUG u.c.c.vlcj.player.DefaultMediaPlayer - after play
    MPEG4GenericRTPSource Warning: Unknown or unsupported "mode": AAC-hbr
    [1682c9cc] core input error: ES_OUT_RESET_PCR called
    [16f79744] core decoder error: cannot continue streaming due to errors
    [1682c9cc] core input error: ES_OUT_RESET_PCR called
    [h264 @ 1702ba80] decode_slice_header error
    [h264 @ 1702ba80] decode_slice_header error
    [16828134] stream_out_transcode stream out: input interval 41666 (base 2)
    [16828134] stream_out_transcode stream out: output interval 41666 (base 1)
  • Transcoding videos with LibAvFormat for playback on iOS devices

    18 mai 2016, par user361526

    I’m trying to transcode a video on my iOS app using FFMpeg/LibAv.
    What I’m trying to accomplish is to transcode a video in order to resize each frame and possibly lower the bitrate in order to save valuable MB in the device.

    The resulting video must be playable on all iPhone5+ devices.

    After reading the documentation I found out that :

    • I do not need to encode/decode the audio stream -> I’ll copy as-is to the output file
    • I need to encode the video using the h264 codec (LibX264) with a profile supported by iOS (baseline profile with level 3.0 - https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility)
    • I’m also setting the picture format to YUV planar since it’s the only one supported by iOS
    • For the sake of testing I’m not using any filter (I’m using a dummy/passthrough) at all or even trying to lower the bitrate, I’m just trying to decode the video stream and encode it again
    • Most of the code is based on the transcoding.c and filtering.c available on the FFMpeg examples directory

    FFMpeg-wise what I’m trying to achieve with LibAv is :

    ffmpeg -i INPUT.MOV -c:v libx264 -preset ultrafast -profile:v baseline -level 3.0  -c:a copy output.MOV

    (the resulting file - which can be found below - is playable on QuickTime if it’s generated by FFMpeg through the command line)

    The original video was generated with a regular iPhone using iOS 8.2 but the problem is not device specific or iOS specific, it occurs on all videos generated with LibAv.

    Although both resulting files are playable by VideoLan (VLC) the one I generated through LibAv is not playable by QuickTime even though I can’t find anything wrong with it.

    As you can see below, I create the video stream with the proper video codec on the call to avformat_new_stream :

    AVStream *out_stream; // output stream
    AVStream *in_stream; // input stream
    AVCodecContext *dec_ctx, *enc_ctx; // codec context for the stream
    AVCodec *encoder; // codec used
    int ret;
    unsigned int i;

    ofmt_ctx = NULL;
    // Allocate an AVFormatContext for an output format. This will be the file header (similar to avformat_open_input but with an zero'ed memory)
    avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, filename);
    if (!ofmt_ctx) {
       av_log(NULL, AV_LOG_ERROR, "Could not create output context\n");
       [self errorWith:kErrorCreatingOutputContext and:@"Could not create output context"];
       return AVERROR_UNKNOWN;
    }
    // we must not use the AVCodecContext from the video stream directly! So we have to use avcodec_copy_context() to copy the context to a new location (after allocating memory for it, of course).
    // iterate over all input streams
    for (i = 0; i < ifmt_ctx->nb_streams; i++) {
       in_stream = ifmt_ctx->streams[i]; // input stream
       dec_ctx = in_stream->codec; // get the codec context for the decoder

       if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
           // lets use h264
           encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
           if (!encoder) {
               [self errorWith:kErrorCodecNotFound and:@"H264 Codec Not Found"];
               return AVERROR_UNKNOWN;
           }
           out_stream = avformat_new_stream(ofmt_ctx, encoder); // create a new stream with h264 codec
           if (!out_stream) {
               av_log(NULL, AV_LOG_ERROR, "Failed allocating output stream\n");
               [self errorWith:kErrorAllocateOutputStream and:@"Failed allocating output stream"];
               return AVERROR_UNKNOWN;
           }
           enc_ctx = out_stream->codec; // pointer to the stream codec context
           /* we transcode to same properties (picture size,
            * sample rate etc.). These properties can be changed for output
            * streams easily using filters */
           if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
               enc_ctx->width = dec_ctx->width;
               enc_ctx->height = dec_ctx->height;
               enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
               enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
               enc_ctx->time_base = dec_ctx->time_base;
               av_opt_set(enc_ctx->priv_data, "preset", "ultrafast", 0);
               av_opt_set(enc_ctx->priv_data, "profile", "baseline", 0);
               av_opt_set(enc_ctx->priv_data, "level", "3.0", 0);
           }

           out_stream->time_base = in_stream->time_base;

           AVDictionaryEntry *tag = NULL;
           while ((tag = av_dict_get(in_stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
               printf("%s=%s\n", tag->key, tag->value);
               char *k = av_strdup(tag->key);       // if your strings are already allocated,
               char *v = av_strdup(tag->value);     // you can avoid copying them like this
               av_dict_set(&out_stream->metadata, k, v, 0);
           }

           ret = avcodec_open2(enc_ctx, encoder, NULL);
           if (ret < 0) {
               av_log(NULL, AV_LOG_ERROR, "Cannot open video encoder for stream #%u\n", i);
               [self errorWith:kErrorCantOpenOutputFile and:[NSString stringWithFormat:@"Cannot open video encoder for stream #%u",i]];
               return ret;
           }

       }
       else if(dec_ctx->codec_type == AVMEDIA_TYPE_UNKNOWN) {
           // if we cant figure out the stream type, fail
           av_log(NULL, AV_LOG_FATAL, "Elementary stream #%d is of unknown type, cannot proceed\n", i);
           [self errorWith:kErrorUnknownStream and:[NSString stringWithFormat:@"Elementary stream #%d is of unknown type, cannot proceed",i]];
           return AVERROR_INVALIDDATA;
       }
       else {
           out_stream = avformat_new_stream(ofmt_ctx, NULL);
           if (!out_stream) {
               av_log(NULL, AV_LOG_ERROR, "Failed allocating output stream\n");
               [self errorWith:kErrorAllocateOutputStream and:@"Failed allocating output stream"];
               return AVERROR_UNKNOWN;
           }
           enc_ctx = out_stream->codec;
           /* this stream must be remuxed */
           // copies ifmt_ctx->streams[i]->codec into ofmt_ctx->streams[i]->codec - Copy the settings of the source AVCodecContext into the destination AVCodecContext.
           ret = avcodec_copy_context(ofmt_ctx->streams[i]->codec,
                                      ifmt_ctx->streams[i]->codec);
           if (ret < 0) {
               av_log(NULL, AV_LOG_ERROR, "Copying stream context failed\n");
               [self errorWith:kErrorCopyStreamFailed and:@"Copying stream context failed"];
               return ret;
           }

       }
       // dunno what this is for
       if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
           enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

    }
    if (!(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) {
       // Create and initialize a AVIOContext for accessing the
       // resource indicated by url.
       ret = avio_open(&ofmt_ctx->pb, filename, AVIO_FLAG_WRITE);
       if (ret < 0) {
           av_log(NULL, AV_LOG_ERROR, "Could not open output file '%s'", filename);
           [self errorWith:kErrorCantOpenOutputFile and:[NSString stringWithFormat:@"Could not open output file '%s'", filename]];
           return ret;
       }
    }

    /* init muxer, write output file header */
    // Allocate the stream private data and write the stream header to an output media file.
    ret = avformat_write_header(ofmt_ctx, NULL);
    if (ret < 0) {
       av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n");
       [self errorWith:kErrorOutFileCantWriteHeader and:@"Error occurred when opening output file"];
       return ret;
    }
    return 0;

    You can find the files here :

    1. Original final : https://www.dropbox.com/s/2jjs1uy2pu2veyy/IMG_5705.MOV?dl=0
    2. File generated with FFMpeg - https://www.dropbox.com/s/9hfmq3fcifgpfqc/local-ffmpeg.MOV?dl=0
    3. File generated by code - https://www.dropbox.com/s/rttvny39rj7ejpf/generated-by-Ze.MOV?dl=0

    Thank you so much,
    Ze

  • Video Conferencing in HTML5 : WebRTC via Web Sockets

    1er janvier 2014, par silvia

    A bit over a week ago I gave a presentation at Web Directions Code 2012 in Melbourne. Maxine and John asked me to speak about something related to HTML5 video, so I went for the new shiny : WebRTC – real-time communication in the browser.

    Presentation slides

    I only had 20 min, so I had to make it tight. I wanted to show off video conferencing without special plugins in Google Chrome in just a few lines of code, as is the promise of WebRTC. To a large extent, I achieved this. But I made some interesting discoveries along the way. Demos are in the slide deck.

    UPDATE : Opera 12 has been released with WebRTC support.

    Housekeeping : if you want to replicate what I have done, you need to install a Google Chrome Web Browser 19+. Then make sure you go to chrome ://flags and activate the MediaStream and PeerConnection experiment(s). Restart your browser and now you can experiment with this feature. Big warning up-front : it’s not production-ready, since there are still changes happening to the spec and there is no compatible implementation by another browser yet.

    Here is a brief summary of the steps involved to set up video conferencing in your browser :

    1. Set up a video element each for the local and the remote video stream.
    2. Grab the local camera and stream it to the first video element.
    3. (*) Establish a connection to another person running the same Web page.
    4. Send the local camera stream on that peer connection.
    5. Accept the remote camera stream into the second video element.

    Now, the most difficult part of all of this – believe it or not – is the signalling part that is required to build the peer connection (marked with (*)). Initially I wanted to run completely without a server and just enter the remote’s IP address to establish the connection. This is, however, not a functionality that the PeerConnection object provides [might this be something to add to the spec ?].

    So, you need a server known to both parties that can provide for the handshake to set up the connection. All the examples that I have seen, such as https://apprtc.appspot.com/, use a channel management server on Google’s appengine. I wanted it all working with HTML5 technology, so I decided to use a Web Socket server instead.

    I implemented my Web Socket server using node.js (code of websocket server). The video conferencing demo is in the slide deck in an iframe – you can also use the stand-alone html page. Works like a treat.

    While it is still using Google’s STUN server to get through NAT, the messaging for setting up the connection is running completely through the Web Socket server. The messages that get exchanged are plain SDP message packets with a session ID. There are OFFER, ANSWER, and OK packets exchanged for each streaming direction. You can see some of it in the below image :

    WebRTC demo

    I’m not running a public WebSocket server, so you won’t be able to see this part of the presentation working. But the local loopback video should work.

    At the conference, it all went without a hitch (while the wireless played along). I believe you have to host the WebSocket server on the same machine as the Web page, otherwise it won’t work for security reasons.

    A whole new world of opportunities lies out there when we get the ability to set up video conferencing on every Web page – scary and exciting at the same time !