LIJI32 / GBVideoPlayer2

A new version of GBVideoPlayer with higher resolution, 3-bit stereo PCM audio and video compression
MIT License
95 stars 15 forks source link

Use y4m as the container format for raw video #4

Open frestr opened 4 years ago

frestr commented 4 years ago

On Linux (Ubuntu 18.04) with ffmpeg 4.1.3 I get the following error when compiling a video:

Resizing video...
ffmpeg -loglevel warning -stats -hide_banner -i video.mkv -c:v rawvideo  -vf scale=-2:144 output/
[...]
[mp4 @ 0x55eb35bdd380] Could not find tag for codec rawvideo in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument                
Error initializing output stream 0:0 --                                                                   
[aac @ 0x55eb35b78440] 2 frames left in the queue on closing                                              
[...]                               

Apparently rawvideo is not supported for mp4. This PR uses y4m as a container format intead, which seems to work fine.

Note that I have not tested it on other platforms.

(Edit: This is in addition to #3)

LIJI32 commented 4 years ago

It's a tech demo and not an actively maintained project. The codebase, in fact, did work out of the box when it was released, but was broken by an update to ffmpeg. Testing this fix and making sure it doesn't actually break users of older versions of ffmpeg was not prioritized over my other projects.

sjr765 commented 2 years ago

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator

If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

TheEssem commented 2 years ago

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator

If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

Seems like ffmpeg version 5.0 changed some things that caused it to break. As a workaround for now you can try downgrading to 4.4.

sjr765 commented 2 years ago

@TheEssem I was actually able to get this program to run by doing a combination of the following (I'm on mac):

jdriselvato commented 1 year ago

@sjr765

installing rgbds v0.3.7

How did you install v0.3.7 on Mac? It seems brew doesn't find it, so I guess you had to install via source. but on source, it complains:

Package libpng was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpng.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpng' found
Package libpng was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpng.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpng' found
Jenetrix commented 1 year ago

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

Seems like ffmpeg version 5.0 changed some things that caused it to break. As a workaround for now you can try downgrading to 4.4.

add -rle 0 as an ffmpeg argument on line 50 of the makefile to work around this issue.

sjr765 commented 1 year ago

Hey All,

Just a headsup, I believe if you specify the version on brew it should be able to find the proper version of the dependencies you need.

I did not use homebrew to install rgbds v0.3.7, its been a while but pretty confident I installed it manually!

TehMiloss commented 1 year ago

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

Seems like ffmpeg version 5.0 changed some things that caused it to break. As a workaround for now you can try downgrading to 4.4.

add -rle 0 as an ffmpeg argument on line 50 of the makefile to work around this issue.

Soo... I'm using rgbds 0.3.7, ffmpeg 4.4. I've edited Makefile for changes in a commit and yet it still throws me ROM with video, like TV static. Adding "-rle 0" to line 50 just throws this:

Codec AVOption rle (Use run-length compression) specified for input file #0 (output/niecik3/video.y4m) is not a decoding option.

I'm kinda lost and dumno how to fix it.

Jenetrix commented 1 year ago

Soo... I'm using rgbds 0.3.7, ffmpeg 4.4. I've edited Makefile for changes in a commit and yet it still throws me ROM with video, like TV static. Adding "-rle 0" to line 50 just throws this:

Codec AVOption rle (Use run-length compression) specified for input file #0 (output/niecik3/video.y4m) is not a decoding option.

I'm kinda lost and dumno how to fix it.

This is fix is specific to ffmpeg 5.0 and onward, you do not need to add this option for ffmpeg 4.4.