Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (24)

  • 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

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

Sur d’autres sites (7245)

  • how to encode 25fps

    20 novembre 2020, par Vadik Jony

    i am not a programmer, but a part of my job is recoding. The person befor me left a script that recodes videos.
THE CURRENT PROBLEM : i need to add to the script the line to recode any video to 25 fps. I tried adding -filter:v fps=fps=25 to the script and it works BUT it ignores all other recoding settings. So i would be very happy if someone could help. Sorry for my trivial language, as i said - i am not a programmer :(
HERE IS THE SCRIPT :

    


    import os, subprocess


DIR = r"\\server-01\E\_NEW CONTENT\_Current Time\Actual Programs" 


EXP = r"\\server-01\D\_RENDERED CONTENT\Current Time" 
print ( "=-===-=-=-="  )

ALLDIR =  os.listdir(DIR)
#ext = ".mp4"
#ext = ".mov"
ext = ".mpg"

FL0 = [x for x in ALLDIR if x.endswith("mpg") or x.endswith("mp4") or x.endswith("mxf") or x.endswith("mov") ]


CL = len(FL0)
print ( "Amount of files: ", CL )



#if pres_scaler
#Deint = True
Deint = False 
crop = False
#crop = True
scale = True
#scale = False
#recode = False
recode = True
interlaced_tff = False
cmdlist = []

for i in range(0, CL):
#for i in range(0, 1):
#for i in range(12, CL):
    vfs = []

cur_name = FL0[i]
print ("Input file path: ", cur_name)

new_name = os.path.splitext(cur_name)[0] + ".mp4"
PATH = DIR + os.sep + cur_name

EXPATH = EXP + os.sep + new_name

if Deint:
    #yadif = " -vf \"yadif=0:0:0\" "
    vfs.append("yadif=0:0:0")
    #vfs.append("drawbox=x=0:y=0:w=720:h=2:color=black:t=max")
    #yadif = " -vf \"yadif=0:0:0,drawbox=x=0:y=0:w=720:h=4:color=black:t=max\" "
else : yadif = ""
if interlaced_tff:
    vfs.append("fieldorder=tff" )
if crop:
    vfs.append("crop=720:432:0:72" )
if scale:
    vfs.append("scale=720x576" )
if len(vfs) > 0:
    vfcmd = "-vf \"" + ",".join(vfs) + "\""
else: vfcmd = ""
print (vfcmd)
cmd = "ffmpeg -hide_banner -i \"" + PATH + "\" " + vfcmd 

if recode:
    
    cmd = cmd + ' -aspect "16:9" -profile:v main -c:v libx264 -pix_fmt yuv420p -filter:v fps=fps=25  '
    if interlaced_tff:
        cmd = cmd + " -flags +ildct+ilme -x264opts tff=1 "
    cmd = cmd + '   -crf 19  -b:a 192k  -ar 48000 -ac 2 '
else: 
    cmd = cmd + " -c:v copy " + " -af \"volume=2\" -ar 48000 " 


cmd = cmd + "\"" + EXPATH + "\""

print ( cmd )
cmdlist.append(cmd)
print ( "=-===-=-=-=" )
subprocess.call(cmd)


    


    and here is the text i am getting from FFMPEG :

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\server-01\E\_NEW 
CONTENT\_Current Time\Actual Programs\PROG_Detali_80_Robopes_na_zavode_Ford_ 1017.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2020-10-17T05:10:47.000000Z
  Duration: 00:23:22.28, start: 0.000000, bitrate: 15331 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 14999 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
  creation_time   : 2020-10-17T05:10:47.000000Z
  handler_name    : ?Mainconcept Video Media Handler
  encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2020-10-17T05:10:47.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
Only '-vf fps=fps=25' read, ignoring remaining -vf options: Use ',' to separate filters
Only '-af (null)' read, ignoring remaining -af options: Use ',' to separate filters
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000016645a43040] using SAR=1/1
[libx264 @ 0000016645a43040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000016645a43040] profile Main, level 4.0, 4:2:0, 8-bit
[libx264 @ 0000016645a43040] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=19.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '\\server-01\D\_RENDERED CONTENT\Current     Time\PROG_Detali_80_Robopes_na_zavode_Ford_ 1017.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    encoder         : Lavf58.39.101
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2020-10-17T05:10:47.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : Lavc58.73.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2020-10-17T05:10:47.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      encoder         : Lavc58.73.102 aac
frame=  217 fps= 23 q=24.0 size=   10496kB time=00:00:08.64 bitrate=9951.8kbits/s speed=0.926x    


    


  • How to fix video in gallery from not playing (probable cause encoding from ffmpeg)

    30 avril 2020, par Nathan Sinclair

    I'm setting up a video stream by which I can download a video into the Android gallery, so that I can play it back later.
I have a problem with playing the video back from gallery. The same problem arises when trying to view the url in a videoview.

    



    video information from ffmpeg displays this.

    



    Input #0, mpjpeg, from '':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x1cab5e0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x1c6f030] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x1c6f030] profile Constrained Baseline, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x1c6f030] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 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=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf58.33.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x406, q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.59.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Error opening file out.mp4: IsoMedia File is truncated28.56 bitrate= 734.1kbits/s speed=0.478x
[pid: 5138|app: 0|req: 1/1] 192.168.178.21 () {32 vars in 406 bytes} [Mon Oct  7 01:12:17 2019] GET /stop => generated 39 bytes in 152 msecs (HTTP/1.1 200) 2 headers in 79 bytes (1 switches on core 0)
frame=  899 fps= 15 q=-1.0 Lsize=    2779kB time=00:00:29.93 bitrate= 760.6kbits/s speed=0.49x
video:2775kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.157041%


    



    I have attempted to follow this article. Android MediaPlayer error (1, -2147483648)

    



    I'm using FFMpeg to record from a mjpeg stream into a file, which then is hosted by a uwsgi/flask server into a convenient url : http://ipaddress/video.mp4

    



    Thus far ive been able to open the video fine using chrome in Android.

    



    my FFMPEG command looks like this :

    



    ffmpeg -i $1 -crf 18 -r 30 -vf "scale=720x406, setpts='1/(30*TB) * (N + 0.05 * sin(N*2*PI/25))', fps=fps=30" -profile:v baseline -pix_fmt yuv420p -f mp4 -preset fast out.mp4


    



    I thought it may have something to do with the transmission of the file. I'm using an android library called volley to send the url so it can be downloaded as a file on the Android. Then it is subsequently put in gallery. This is when I began to experience the problems. I wanted to be thorough, so tried to find out if the file contents was the issue. This is because when displaying it on gallery, there is no width or height information, or even duration. I have come to suspect something is at issue with ffmpeg. I'm not cutting out that it could be keeping the file from opening if it can't find it's normal file properties.

    



    The volley code for the downloaded file is as follows :

    



     @Override
    public void onResponse(byte[] response) {
        try {
            if (response!=null) {

                File file = createVideoFile();

                FileOutputStream stream = new FileOutputStream(file);
                try {
                    stream.write(response);
                } finally {
                    stream.close();
                }

                addToGallery(file.getAbsolutePath());
                MediaScannerConnection.scanFile(this, new String[]{file.getAbsolutePath()}, null, (path, uri) -> {
                    Intent intent = new Intent (context, VideoActivity.class);
                    intent.setData(uri);
                    startActivity(intent);

                });


                Toast.makeText(this, "Download complete.", Toast.LENGTH_LONG).show();
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            Log.d("KEY_ERROR", "UNABLE TO DOWNLOAD FILE");
            e.printStackTrace();
        }
    }

private void addToGallery(String path) throws FileNotFoundException {
        MediaScannerConnection.scanFile(context, new String[]{

                        path},

                null, new MediaScannerConnection.OnScanCompletedListener() {

                    public void onScanCompleted(String path, Uri uri)

                    {

                        Log.e(TAG, "file" + path + " was scanned successfully");

                    }

                });

        Uri uri = Uri.parse("file:///" + path);
        Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri);
        context.sendBroadcast(intent);

        }


    



    I did have a VideoView to display it, as pertaining to a code example i found to download videos using volley.

    



    https://github.com/coderminion/AndroidVolleyLib

    


  • "ffmpeg has text relocations" error in Android

    5 janvier 2015, par djzmo

    I’m building an Android video-sending application. I need the video to be compressed before being uploaded. In this case, I chose to use this Android wrapper of FFmpeg : https://github.com/hiteshsondhi88/ffmpeg-android-java

    FFmpeg error: WARNING: linker: /data/data/com.mycompany.myapplication/files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
       ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
       built on Oct  7 2014 15:08:46 with gcc 4.8 (GCC)
       configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
       libavutil      54.  7.100 / 54.  7.100
       libavcodec     56.  1.100 / 56.  1.100
       libavformat    56.  4.101 / 56.  4.101
       libavdevice    56.  0.100 / 56.  0.100
       libavfilter     5.  1.100 /  5.  1.100
       libswscale      3.  0.100 /  3.  0.100
       libswresample   1.  1.100 /  1.  1.100
       libpostproc    53.  0.100 / 53.  0.100
       Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/VID_20150104_235926.mp4':
       Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       creation_time   : 2015-01-04 16:00:40
       Duration: 00:01:12.60, start: 0.000000, bitrate: 19590 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 19364 kb/s, SAR 65536:65536 DAR 16:9, 26.73 fps, 26.92 tbr, 90k tbn, 180k tbc (default)
       Metadata:
       creation_time   : 2015-01-04 16:00:40
       handler_name    : VideoHandle
       Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
       Metadata:
       creation_time   : 2015-01-04 16:00:40
       handler_name    : SoundHandle
       [libx264 @ 0x40208800] using SAR=1/1
       [libx264 @ 0x40208800] frame MB size (120x68) > level limit (1620)
       [libx264 @ 0x40208800] DPB size (1 frames, 8160 mbs) > level limit (0 frames, 8100 mbs)
       [libx264 @ 0x40208800] MB rate (219640) > level limit (40500)
       [libx264 @ 0x40208800] using cpu capabilities: none!
       [libx264 @ 0x40208800] profile Constrained Baseline, level 3.0
       [libx264 @ 0x40208800] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=0 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_lookahead=0 rc=crf mbtree=0 crf=28.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2500 vbv_bufsize=1835 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
       Output #0, mp4, to '/storage/emulated/0/Android/data/com.mycompany.myapplication/cache/VID_20150104_235926.mp4':
       Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       encoder         : Lavf56.4.101
       Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 65536:65536 DAR 16:9], q=-1--1, 2500 kb/s, 26.92 fps, 10336 tbn, 26.92 tbc (default)
       Metadata:
       creation_time   : 2015-01-04 16:00:40
       handler_name    : VideoHandle
       encoder         : Lavc56.1.100 libx264
       Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 4

    Everything seemed fine when I compress small files (below 20 seconds), but when I tried to compress larger files, I seldom get the above error in the middle of the compression process, and the process was also terminated immediately. I need the application to be able to compress one minute video to about 20-35 MB.

    Here is the FFmpeg command I used :

    ffmpeg -y -i -codec:v libx264 -profile:v baseline -level 3.0 -b:v 2500k -minrate 2500k -maxrate 2500k -bufsize 1835k -pix_fmt yuv420p -preset ultrafast -crf 28 -codec:a copy

    Any idea on what went wrong ?
    Any kind of help would be very appreciated.