Homebrew MPEG4 Player for DS and DSi

jonjonmia

New Member
Newbie
Joined
Jul 7, 2021
Messages
4
Trophies
0
Age
28
XP
43
Country
United States
For all those people out there struggling to play audio with video over 5 mins long and is faced with desync and garbled audio I think I have a decent solution.

After using the mmpeg command line that creates the compatible video use this command line:

Code:
ffmpeg -i input.mp4 -c copy -map 0 -segment_time 00:50:00 -f segment output%03d.mp4

The command line splits the video into 5 minute segments. This means the audio should "reset" ever 5 mins all you have to do is move on to part 2 and then part 3 and so on. You can adjust the length of each segment as you see fit.

Hope this helps somebody!
 
  • Like
Reactions: Tarmfot

Nicktender

New Member
Newbie
Joined
Nov 13, 2021
Messages
1
Trophies
0
Age
24
XP
37
Country
United States
Code:
ffmpeg -i %1 -f mp4 -vf "fps=24000/1001, colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709, scale=256:144" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -q:v 2 -maxrate 500k -acodec aac -ar 32k -b:a 64000 -ac 1 -slices 1 -g 50 %2
hopw do i run it/? IM new to dhis stype of thinfs
 

Remus_Master

New Member
Newbie
Joined
Jun 17, 2021
Messages
1
Trophies
0
Age
43
XP
63
Country
Mexico
[MP4DSi Converter mini Tutorial]

Step 1.- Create folder in C drive to convert videos:

(for example if you have NDS):

C:\mp4ds\input_video

C:\mp4ds\output_video

(or if you have NDSi):

C:\mp4dsi\input_video

C:\mp4dsi\output_video

Step 2.- Put video for converter in the folder "input_video" rename file to videoenter.mp4

Step 3.- Open the command prompt as administrator

Step 4.- Change to directory where it is located ffmpeg for example:

CD C:\ffmpeg\bin

Step 5.- Use cmd

for NDS

Code:
ffmpeg -i C:\mp4ds\input_video\videoenter.mp4 -f mp4 -vf "fps=24000/1001, colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709, scale=176:144" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -q:v 2 -maxrate 500k -acodec aac -ar 22050 -b:a 64000 -ac 1 -slices 1 -g 50 C:\mp4ds\output_video\videoexit.mp4

or NDSi

Code:
ffmpeg -i C:\mp4dsi\input_video\videoenter.mp4 -f mp4 -vf "fps=30000/1001, colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709, scale=256:144" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -q:v 3 -maxrate 1100k -acodec aac -ar 32k -b:a 128000 -ac 1 -slices 1 -g 50 C:\mp4dsi\output_video\videoexit.mp4

Step 6.- Enter in folder "output_video" now can rename file "videoexit.mp4" before to transfer

Step 7.- Copy video file renamed to Micro SD

Note: Sorry my bad english, I´m speak another language, the test in my ndsi 30min max video work fine.

Update: MP4DSi MENU Automated
Just copy following code in notepad save as MP4DSi_Converter.bat open and follow instructions on screen and all files will be converted from input_video folder to output_video automatically.

Code:
___________________________________________________________________________________

color 0D
:Menu
@echo off
cls
echo.
:mainmenu
echo  -----------------------------------
echo          MP4DSi MENU Automated
echo  -----------------------------------
echo.
echo      1) START MP4  DS Mode Converter.
echo      2) START MP4  DSi Mode Converter.
echo      3) CLOSE MP4 DS/DSi Mode Converter.
echo.
echo  -----------------------------------
echo.
set /p opcion=Select one the next options [1-3]:
cls
if %opcion%==1 goto :FIRST
if %opcion%==2 goto :SECOND
if %opcion%==3 goto :THIRD
goto :Menu
:FIRST
cls
color a
@echo off
echo  -----------------------------------
echo  START MP4  DS Mode Converter.
echo  -----------------------------------
echo Automated DS mode mp4 converter, convert all videos in mp4ds\input_video folder to mp4ds\output_video.
@echo on
CD C:\ffmpeg\bin
for %%a in ("C:\mp4ds\input_video\*.mp4") do ffmpeg -i "%%a" -f mp4 -vf "fps=24000/1001, colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709, scale=176:144" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -q:v 2 -maxrate 500k -acodec aac -ar 22050 -b:a 64000 -ac 1 -slices 1 -g 50 "C:\mp4ds\output_video\%%~na.mp4"
Pause
goto :Menu
:SECOND
cls
color b
@echo off
echo  -----------------------------------
echo  START MP4  DSi Mode Converter.
echo  -----------------------------------
echo Automated DSi mode mp4 converter, convert all videos in mp4dsi\input_video folder to mp4ds\output_video.
@echo on
CD C:\ffmpeg\bin
for %%a in ("C:\mp4dsi\input_video\*.mp4") do ffmpeg -i "%%a" -f mp4 -vf "fps=30000/1001, colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709, scale=256:144" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -q:v 3 -maxrate 1100k -acodec aac -ar 32k -b:a 128000 -ac 1 -slices 1 -g 50  "C:\mp4dsi\output_video\%%~na.mp4"
Pause
goto :Menu
:THIRD
cls
color c
@echo off
echo  -----------------------------------
echo  CLOSE MP4 DS/DSi Mode Converter.
echo  -----------------------------------
echo Thank you for use this code by Remus_Master good bye.
@echo on
Pause
goto exit
___________________________________________________________________________________
 
Last edited by Remus_Master,
  • Love
Reactions: assassinz

Spider2099

Member
Newcomer
Joined
Aug 7, 2021
Messages
11
Trophies
0
Age
20
XP
64
Country
United States
To do any file without the renaming process just make a folder name, in the same location as the program, output and run this program, it will do any .mp4 in the same location as the program.

for %%a in (*.mp4) Do ffmpeg -i "%%a" -f mp4 -vf "fps=30000/1001, colorspace=space=ycgco: primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709, scale=256:192" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -q:v 2 -maxrate 1100k -acodec aac -ar 32k -b:a 128000 -ac 1 -slices 1 -g 50 "output\%%~na.mp4"
 

packattack77

Active Member
Newcomer
Joined
Apr 10, 2022
Messages
38
Trophies
0
Age
15
Location
Jacksonville, florida
XP
100
Country
United States
i downloaded the player, now how do i play the video, as i don't understand what all the info in the top is.

"long story short, please dumb it down for me to understand im stupid like that so yea"
 

Memedew

Well-Known Member
Newcomer
Joined
Apr 3, 2022
Messages
57
Trophies
0
Age
23
Location
Rive-Nord (Couronne Nord) De Montréal.
Website
sites.google.com
XP
186
Country
Canada
Lately I've been working to make a spinoff from my YoutubeDS project from a couple of years ago, to make it into a useable video player. After a lot of bugfixes and improvements I've managed to get pretty nice results. Mainly on DSi it works very well. It plays mpeg4 video and aac audio in a mp4 container. Note that the code is pretty shitty as it is a modified version of youtube ds. This project might be incorporated in some general purpose media player for ds(i) at some point, but concrete plans have not been made yet. The code can be build with the latest version of devkitpro.

How to convert
Use a recent version of ffmpeg. The player plays 176x144 stretched to widescreen with a little filtering and 256x144. Instead of the normal YUV color space, YCoCg is used because it is faster to convert to rgb. Ignore any warnings you get about it. On a pc the colors will look wrong, but it's fine in the player.
Recommend settings for DS:
Code:
ffmpeg -i %1 -f mp4 -s 176x144 -vf "colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -b:v 350000 -acodec aac -ar 22050 -b:a 64000 -ac 1 -slices 1 -g 50 %2
Recommend settings for DSi:
Code:
ffmpeg -i %1 -f mp4 -s 256x144 -vf "colorspace=space=ycgco:primaries=bt709:trc=bt709:range=pc:iprimaries=bt709:iall=bt709" -dst_range 1 -color_range 2 -vcodec mpeg4 -profile:v 0 -level 8 -b:v 500000 -acodec aac -ar 32000 -b:a 128000 -ac 1 -slices 1 -g 50 %2

In both cases replace %1 with your input video and %2 with your output video. Higher bitrates and such may work, depending on the video. Supported framerates are 23.976 fps and 29.97 fps, although on ds 23.976 will likely give the best results. Other framerates are not properly supported, as currently the rate is not completely correctly read from the mp4 container. It also seems that the bitstream changes a bit with some rates, which make the decoding fail. If your input video doesn't have the right rate, add fps=24000/1001, before colorspace in the commands above. Note that with long videos audio issues may appear after playing for a while. This is related to the precision of the audio timers on arm7. I still have to adjust the video rate so that it matches the amount of increase/decrease in audio rate to fix that (something smaller than 1%, won't be noticable).

Pressing B while playing a video will return to the file browser.

Github: https://github.com/Gericom/YoutubeDS/tree/mpeg4player

Special thanks to @Pk11 for helping with testing and adding the file browser.

Why is this so complicated? What do I do with those lines of codes?
 

Bananaman12314

New Member
Newbie
Joined
Sep 28, 2022
Messages
1
Trophies
0
Age
22
Location
Illinois
XP
12
Country
United States
Does anyone have a way to split long videos into shorter videos so that it's actually supported on the player. Wanna try seeing if I can get some movies on here, think it would be fun
 

RocketRobz

Stylish TWiLight Hero
Developer
Joined
Oct 1, 2010
Messages
16,638
Trophies
3
Age
24
XP
21,096
Country
United States
  • Like
Reactions: Bananaman12314

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
    BakerMan @ BakerMan: leo @'d me in a thread about his last dream, stating he was passionately making out with a guy...