Skip to content

Commit de59431

Browse files
committed
Merge branch 'main' of github.com:pytorch/torchcodec into fltp
2 parents f6c70b6 + 8e611bb commit de59431

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

.github/workflows/build_ffmpeg.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
contents: read
3535
with:
3636
job-name: Build
37-
upload-artifact: ffmpeg-lgpl
37+
upload-artifact: ffmpeg-lgpl-linux_x86_64-${{ matrix.ffmpeg-version }}
3838
repository: pytorch/torchcodec
3939
script: |
4040
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
@@ -56,7 +56,7 @@ jobs:
5656
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
5757
with:
5858
job-name: Build
59-
upload-artifact: ffmpeg-lgpl
59+
upload-artifact: ffmpeg-lgpl-macos-${{ matrix.ffmpeg-version }}
6060
repository: pytorch/torchcodec
6161
runner: macos-14-xlarge
6262
script: |

packaging/build_ffmpeg.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ tar -xf ffmpeg.tar.gz --strip-components 1
6161
--enable-avfilter \
6262
--enable-avformat \
6363
--enable-avutil \
64-
--enable-swscale
64+
--enable-swscale \
65+
--enable-swresample
6566

6667
make -j install
6768
ls ${prefix}/*
@@ -78,27 +79,31 @@ if [[ "$(uname)" == Darwin ]]; then
7879
avdevice=libavdevice.58
7980
avfilter=libavfilter.7
8081
swscale=libswscale.5
82+
swresample=libswresample.3
8183
elif [[ ${major_ver} == 5 ]]; then
8284
avutil=libavutil.57
8385
avcodec=libavcodec.59
8486
avformat=libavformat.59
8587
avdevice=libavdevice.59
8688
avfilter=libavfilter.8
8789
swscale=libswscale.6
90+
swresample=libswresample.4
8891
elif [[ ${major_ver} == 6 ]]; then
8992
avutil=libavutil.58
9093
avcodec=libavcodec.60
9194
avformat=libavformat.60
9295
avdevice=libavdevice.60
9396
avfilter=libavfilter.9
9497
swscale=libswscale.7
98+
swresample=libswresample.4
9599
elif [[ ${major_ver} == 7 ]]; then
96100
avutil=libavutil.59
97101
avcodec=libavcodec.61
98102
avformat=libavformat.61
99103
avdevice=libavdevice.61
100104
avfilter=libavfilter.10
101105
swscale=libswscale.8
106+
swresample=libswresample.5
102107
else
103108
printf "Error: unexpected FFmpeg major version: %s\n" ${major_ver}
104109
exit 1;
@@ -120,7 +125,7 @@ if [[ "$(uname)" == Darwin ]]; then
120125
fi
121126

122127
# list up the paths to fix
123-
for lib in ${avcodec} ${avdevice} ${avfilter} ${avformat} ${avutil} ${swscale}; do
128+
for lib in ${avcodec} ${avdevice} ${avfilter} ${avformat} ${avutil} ${swscale} ${swresample}; do
124129
${otool} -l ${prefix}/lib/${lib}.dylib | grep -B2 ${prefix}
125130
done
126131

@@ -155,6 +160,13 @@ if [[ "$(uname)" == Darwin ]]; then
155160
${prefix}/lib/${swscale}.dylib
156161
${otool} -l ${prefix}/lib/${swscale}.dylib | grep -B2 ${prefix}
157162

163+
${install_name_tool} \
164+
-change ${prefix}/lib/${avutil}.dylib @rpath/${avutil}.dylib \
165+
-delete_rpath ${prefix}/lib \
166+
-id @rpath/${swresample}.dylib \
167+
${prefix}/lib/${swresample}.dylib
168+
${otool} -l ${prefix}/lib/${swresample}.dylib | grep -B2 ${prefix}
169+
158170
${install_name_tool} \
159171
-change ${prefix}/lib/${avcodec}.dylib @rpath/${avcodec}.dylib \
160172
-change ${prefix}/lib/${avutil}.dylib @rpath/${avutil}.dylib \

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ void VideoDecoder::initializeDecoder() {
174174
AVSampleFormat format =
175175
static_cast<AVSampleFormat>(avStream->codecpar->format);
176176
streamMetadata.sampleFormat = av_get_sample_fmt_name(format);
177+
std::cout << "FUCK " << *streamMetadata.sampleFormat << "AFEFMEMFMFE " << std::endl;
177178
containerMetadata_.numAudioStreams++;
178179
}
179180

@@ -1414,9 +1415,9 @@ UniqueAVFrame VideoDecoder::convertAudioAVFrameSampleFormat(
14141415
#else
14151416
convertedAVFrame->channel_layout = avFrame->channel_layout;
14161417
#endif
1418+
convertedAVFrame->format = static_cast<int>(desiredSampleFormat);
14171419
convertedAVFrame->sample_rate = avFrame->sample_rate;
14181420
convertedAVFrame->nb_samples = avFrame->nb_samples;
1419-
convertedAVFrame->format = desiredSampleFormat;
14201421

14211422
auto status = av_frame_get_buffer(convertedAVFrame.get(), 0);
14221423
TORCH_CHECK(

0 commit comments

Comments
 (0)