
Recherche avancée
Médias (21)
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (90)
-
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Publier sur MédiaSpip
13 juin 2013Puis-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 -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)
Sur d’autres sites (12184)
-
Interfacing to an Xbox Optical Drive
1er octobre 2013, par Multimedia Mike — xboxThe next generation Xbox is going to hit the streets soon. But for some reason, I’m still interested in the previous generation’s unit (i.e., the original Xbox). Specifically, I’ve always wondered if it’s possible to use the original Xbox’s optical drive in order to read Xbox discs from Linux. I was never curious enough to actually buy an Xbox just to find out but I eventually came across a cast-off console on a recycle pile.
I have long known that the Xbox has what appears to be a more or less standard optical drive with a 40-pin IDE connector. The only difference is the power adapter which I surmise is probably the easiest way to turn a bit of standardized hardware into a bit of proprietary hardware. The IDE and power connectors look like this :
Thus, I wanted to try opening an Xbox and plugging the optical drive into a regular PC, albeit one that supports IDE cables, and allow the Xbox to supply power to the drive. Do you still have hardware laying around that has 40-pin IDE connectors ? I guess my Mac Mini PPC fits the bill, but I’ll be darned if I’m going to pry that thing open again. I have another IDE-capable machine buried in my closet, last called into service when I needed a computer with a native RS-232 port 3 years ago. The ordeal surrounding making this old computer useful right now can be another post entirely.
Here’s what the monstrosity looks like thanks to characteristically short IDE cable lengths :
Process :
- Turn on Xbox first
- Turn on PC
Doing these things in the opposite order won’t work since the kernel really wants to see the drive when booting up. Inspecting the
'dmesg'
log afterward reveals interesting items :<br />
hdd: PHILIPS XBOX DVD DRIVE, ATAPI CD/DVD-ROM drive<br />
hdd: host max PIO5 wanted PIO255(auto-tune) selected PIO4<br />
hdd: UDMA/33 mode selected<br />
[...]<br />
hdd: ATAPI DVD-ROM drive, 128kB Cache<br />Why is that interesting ? When is the last time to saw disk devices prefixed by ‘hd’ rather than ‘sd’ ? Blast from the past. Oh, and the optical drive’s vendor string clearly indicates that this is an Xbox drive saying ‘hi !’.
Time To Read
When I first studied an Xbox disc in a normal optical drive, I noticed that I was able to read 6992 2048-byte sectors — about 14 MB of data — as reported by the disc table of contents (TOC). This is just enough data to play a standard DVD video animation that kindly instructs the viewer to please use a proper Xbox. At this point, I estimated that there must be something special about Xbox optical drive firmware that knows how to read alternate information on these discs and access further sectors.I ran my TOC query tool with an Xbox Magazine demo disc in the optical drive and it reported substantially more than 6992 sectors, enough to account for more than 2 GB of data. That’s promising. I then tried running
'dd'
against the device and it was able to read… about 14 MB, an exact quantity of bytes that, when divided by 2048 bytes/sector, yields 6992 sectors.Future (Past ?) Work
Assuming Google is your primary window into the broader internet, the world is beginning to lose its memory of things pertaining to the original Xbox (Microsoft’s naming scheme certainly doesn’t help searches). What I’m saying is that it can be difficult to find information about this stuff now. However, I was able to learn that a host needs to perform a sort of cryptographic handshake with the drive at the SCSI level before it is allowed to access the forbidden areas of the disc. I think. I’m still investigating this and will hopefully post more soon. -
FFMPEG : TS video copied to MP4, missing 3 first frames [closed]
21 août 2023, par Vasilis LemonidisRunning :


ffmpeg -i test.ts -fflags +genpts -c copy -y test.mp4



for this test.ts, which has 30 frames, readable by opencv, I end up with 28 frames, out of which 27 are readable by opencv. More specifically :


ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 tmp.ts 



returns 30.


ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 tmp.mp4



returns 28.


Using OpenCV in that manner


cap = cv2.VideoCapture(tmp_path)
readMat = []
while cap.isOpened():
 ret, frame = cap.read()
 if not ret:
 break
 readMat.append(frame)



I get for the ts file 30 frames, while for the mp4 27 frames.


Could someone explain why the discrepancies ? I get no error during the transformation from ts to mp4 :


ffmpeg version N-111746-gd53acf452f Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 11.3.0 (GCC)
 configuration: --ld=g++ --bindir=/bin --extra-libs='-lpthread -lm' --pkg-config-flags=--static --enable-static --enable-gpl --enable-libaom --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-cuda-nvcc --enable-cuvid --enable-nvenc --enable-libnpp 
 libavutil 58. 16.101 / 58. 16.101
 libavcodec 60. 23.100 / 60. 23.100
 libavformat 60. 10.100 / 60. 10.100
 libavdevice 60. 2.101 / 60. 2.101
 libavfilter 9. 10.100 / 9. 10.100
 libswscale 7. 3.100 / 7. 3.100
 libswresample 4. 11.100 / 4. 11.100
 libpostproc 57. 2.100 / 57. 2.100
[mpegts @ 0x4237240] DTS discontinuity in stream 0: packet 5 with DTS 306003, packet 6 with DTS 396001
Input #0, mpegts, from 'tmp.ts':
 Duration: 00:00:21.33, start: 3.400000, bitrate: 15 kb/s
 Program 1 
 Metadata:
 service_name : Service01
 service_provider: FFmpeg
 Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 300x300, 1 fps, 3 tbr, 90k tbn
Output #0, mp4, to 'test.mp4':
 Metadata:
 encoder : Lavf60.10.100
 Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 300x300, q=2-31, 1 fps, 3 tbr, 90k tbn
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/mp4 @ 0x423e280] video:25kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.192123%
frame= 30 fps=0.0 q=-1.0 Lsize= 26kB time=00:00:21.00 bitrate= 10.3kbits/s speed=1e+04x 



Additional information


The origin of the video I am processing comes from a continuous stitching operation of still images ts videos, produced by this class
update
method :

import cv2
import os
import subprocess
from tempfile import NamedTemporaryFile
class VideoUpdater:
 def __init__(
 self, video_path: str, framerate: int, timePerFrame: Optional[int] = None
 ):
 """
 Video updater takes in a video path, and updates it using a supplied frame, based on a given framerate.
 Args:
 video_path: str: Specify the path to the video file
 framerate: int: Set the frame rate of the video
 """
 if not video_path.endswith(".mp4"):
 LOGGER.warning(
 f"File type {os.path.splitext(video_path)[1]} not supported for streaming, switching to ts"
 )
 video_path = os.path.splitext(video_path)[0] + ".mp4"

 self._ps = None
 self.env = {
 
 }
 self.ffmpeg = "/usr/bin/ffmpeg "

 self.video_path = video_path
 self.ts_path = video_path.replace(".mp4", ".ts")
 self.tfile = None
 self.framerate = framerate
 self._video = None
 self.last_frame = None
 self.curr_frame = None


 def update(self, frame: np.ndarray):
 if len(frame.shape) == 2:
 frame = cv2.cvtColor(frame, cv2.COLOR_GRAY2BGR)
 else:
 frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
 self.writeFrame(frame)

 def writeFrame(self, frame: np.ndarray):
 """
 The writeFrame function takes a frame and writes it to the video file.
 Args:
 frame: np.ndarray: Write the frame to a temporary file
 """


 tImLFrame = NamedTemporaryFile(suffix=".png")
 tVidLFrame = NamedTemporaryFile(suffix=".ts")

 cv2.imwrite(tImLFrame.name, frame)
 ps = subprocess.Popen(
 self.ffmpeg
 + rf"-loop 1 -r {self.framerate} -i {tImLFrame.name} -t {self.framerate} -vcodec libx264 -pix_fmt yuv420p -y {tVidLFrame.name}",
 env=self.env,
 shell=True,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 )
 ps.communicate()
 if os.path.isfile(self.ts_path):
 # this does not work to watch, as timestamps are not updated
 ps = subprocess.Popen(
 self.ffmpeg
 + rf'-i "concat:{self.ts_path}|{tVidLFrame.name}" -c copy -y {self.ts_path.replace(".ts", ".bak.ts")}',
 env=self.env,
 shell=True,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 )
 ps.communicate()
 shutil.move(self.ts_path.replace(".ts", ".bak.ts"), self.ts_path)

 else:
 shutil.copyfile(tVidLFrame.name, self.ts_path)
 # fixing timestamps, we dont have to wait for this operation
 ps = subprocess.Popen(
 self.ffmpeg
 + rf"-i {self.ts_path} -fflags +genpts -c copy -y {self.video_path}",
 env=self.env,
 shell=True,
 # stdout=subprocess.PIPE,
 # stderr=subprocess.PIPE,
 )
 tImLFrame.close()
 tVidLFrame.close()



-
Weird commandline behaviour when running a batch script. Script will only work if another script is being run first [closed]
31 décembre 2022, par MacsterTLDR ;

In cmd.exe

makedir.bat
only <= Not working

new.bat
thenmakedir.bat
<= Working

I'm new to batch and noticed a weird behaviour when running a scrip.


It basically takes the last entry(Video file path) from a textfile and uses the path inside a ffmpeg command to get the file duration. But it's not working.
makedir.bat


What I know is that the part which gets the path is working on it's own, and so does the part that gets the duration.


Now, if I run a second script,
new.bat
, which is actually just the part that gets the files duration and outputs the right duration(22 Seconds), before runningmakedir.bat
, suddenlymakedir.bat
starts working as intended, even thoughset /a duration=2*3600*60+*1
in the output is wrong. But thats only forcmd.exe
. It wont work forPowerShell
.
Whats going on ? Is the script faulty or is there some kind of caching in the cmd.exe ?

EDIT : Oh, and if I run
makedir.bat
first and thennew.bat
, new.bat wont work anymore.

makedir.bat


::Get last entry from "mylist.txt"
for /f "delims=" %%a in ('type mylist.txt ^| findstr /b /c:"file"') do set path=%%a

::Trim path for file name
set video_path=%path:~32,-1%

echo %video_path%

::Get the video duration
for /f "tokens=1* delims=:" %%a in ('ffmpeg -i %video_path% 2^>^&1 ^| findstr "Duration"') do set duration=%%b

set duration=%duration:~0,12%
set /a duration=%duration:~1,2%*3600+%duration:~4,2%*60+%duration:~7,2%*1
echo %duration%



new.bat


for /F "tokens=1* delims=:" %%a in ('ffmpeg -i pipshort1.webm 2^>^&1 ^| findstr "Duration"') do set duration=%%b
set duration=%duration:~0,12%
set /a duration=%duration:~1,2%*3600+%duration:~4,2%*60+%duration:~7,2%*1



Ouput makedir.bat


>for /F "delims=" %a in ('type mylist.txt | findstr /b /c:"file"') do set path=%a

>set path=file '/webapp/stream/videos/pip/transparent_short.webm'

>set path=file '/webapp/stream/videos/pip/transparent_short.webm'

>set path=file '/webapp/stream/videos/pip/transparent_short.webm'

>set path=file '/webapp/stream/videos/pip/pipshort1.webm'

>set video_path=pipshort1.webm

>echo pipshort1.webm
pipshort1.webm

>for /F "tokens=1* delims=:" %a in ('ffmpeg -i pipshort1.webm 2>&1 | findstr "Duration"') do set duration=%b

>set duration=~0,12

>set /a duration=0,*3600+2*60+*1
Missing operator

>echo 0
0



Output new.bat + makedir.bat


>new.bat

>for /F "tokens=1* delims=:" %a in ('ffmpeg -i pipshort1.webm 2>&1 | findstr "Duration"') do set duration=%b

>set duration= 00:00:22.02, start: 0.000000, bitrate: 2337 kb/s

>set duration= 00:00:22.02

>set /a duration=00*3600+00*60+22*1

>echo 22
22

>makedir.bat

>for /F "delims=" %a in ('type mylist.txt | findstr /b /c:"file"') do set path=%a

>set path=file '/webapp/stream/videos/pip/transparent_short.webm'

>set path=file '/webapp/stream/videos/pip/transparent_short.webm'

>set path=file '/webapp/stream/videos/pip/transparent_short.webm'

>set path=file '/webapp/stream/videos/pip/pipshort1.webm'

>set video_path=pipshort1.webm

>echo pipshort1.webm
pipshort1.webm

>for /F "tokens=1* delims=:" %a in ('ffmpeg -i pipshort1.webm 2>&1 | findstr "Duration"') do set duration=%b

>set duration=22

>set /a duration=2*3600+*60+*1
Missing operator

>echo 22
22